test(casts): add tests for ShopperEstablishmentCodeCast functionality test(casts): add tests for ShopperServiceCodeCast functionality test(casts): add tests for ShopperSiteCodeCast functionality test(dto): update ProductDtoTest to include additional fields test(dto): update SettingDtoTest to remove arcadiaSites assertions test(events): update AnOrderHasBeenPlacedTest to use value objects test(entities): update OrderTest to use value objects for employee details test(value-objects): update EmployeeUpsertDataTest to use value objects test(pagination): update PaginationTest to access value properties test(services): update AppCustomerAuthServiceTest to use CrmHashcode test(services): update CrmServiceTest to use CrmHashcode for customer retrieval
55 lines
1.8 KiB
PHP
55 lines
1.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Dto\ProductDto;
|
|
|
|
describe('ProductDto', function () {
|
|
test('it can be instantiated with all properties', function () {
|
|
// GIVEN
|
|
$id = '018f6c40-1234-7123-8123-123456789012';
|
|
$name = 'Poulet Fermier';
|
|
$slug = 'poulet-fermier';
|
|
|
|
// WHEN
|
|
$dto = new ProductDto(
|
|
id: $id,
|
|
name: $name,
|
|
slug: $slug,
|
|
);
|
|
|
|
// THEN
|
|
expect($dto->id)->toBe($id)
|
|
->and($dto->name)->toBe($name)
|
|
->and($dto->slug)->toBe($slug)
|
|
->and($dto->getRouteKey())->toBe($slug)
|
|
->and($dto->getRouteKeyName())->toBe('slug')
|
|
->and($dto->resolveRouteBinding('some-id'))->toBeNull()
|
|
->and($dto->resolveChildRouteBinding('child', 'some-id', 'field'))->toBeNull();
|
|
|
|
$array = $dto->toArray();
|
|
expect($array)->toBe([
|
|
'id' => $id,
|
|
'name' => $name,
|
|
'slug' => $slug,
|
|
'brand' => null,
|
|
'inco' => null,
|
|
'picture' => null,
|
|
'picture_alt' => null,
|
|
'picture_title' => null,
|
|
'picture_large' => null,
|
|
'picture_large_alt' => null,
|
|
'picture_large_title' => null,
|
|
'price' => null,
|
|
'discount' => null,
|
|
'stock' => 0,
|
|
'sell_unit' => null,
|
|
'range' => null,
|
|
'order' => 0,
|
|
'status' => false,
|
|
'star' => false,
|
|
'short_description' => null,
|
|
'description' => null,
|
|
]);
|
|
});
|
|
});
|