ldc-cocotte/tests/Unit/App/Dto/DiscountProductDtoTest.php
Jérémy Munsch 020e2f8526
test(DiscountProductDto): update tests to include picture attribute
Added picture attribute to the DiscountProductDto tests to ensure proper serialization.
2026-10-28 11:57:37 +01:00

37 lines
960 B
PHP

<?php
declare(strict_types=1);
namespace Tests\Unit\App\Dto;
use App\Dto\DiscountProductDto;
describe('DiscountProductDto', function (): void {
it('creates a DTO from constructor and serializes to array and json', function (): void {
// GIVEN
$id = '018f-product-uuid';
$name = 'Poulet Fermier';
$picture = 'image.png';
// WHEN
$dto = new DiscountProductDto(
id: $id,
name: $name,
picture: $picture
);
// THEN
expect($dto->id)->toBe($id)
->and($dto->name)->toBe($name)
->and($dto->toArray())->toBe([
'id' => $id,
'name' => $name,
'picture' => $picture,
])
->and($dto->jsonSerialize())->toBe([
'id' => $id,
'name' => $name,
'picture' => $picture,
]);
});
});