ldc-boutique-cnc-sable/tests/Unit/App/Dto/SettingDtoTest.php
Jérémy Munsch 8b96ce90be
test(casts): add tests for EmployeeSitesCast functionality
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
2026-10-27 09:58:45 +01:00

34 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
use App\Dto\SettingDto;
use Domain\Models\ValueObjects\ShopperSiteCode;
describe('SettingDto', function (): void {
it('creates a DTO and provides helper methods', function (): void {
// GIVEN
$id = 1;
$sites = ['PA', 'LY'];
// WHEN
$dto = new SettingDto(id: $id, employeeSites: $sites);
// THEN
expect($dto->id)->toBe(1)
->and($dto->employeeSites)->toBe(['PA', 'LY'])
->and($dto->employeeSitesAsString())->toBe('PA, LY')
->and($dto->getShopperSiteCodes())->toHaveCount(2)
->and($dto->getShopperSiteCodes()[0])->toBeInstanceOf(ShopperSiteCode::class)
->and($dto->getShopperSiteCodes()[0]->value)->toBe('PA')
->and($dto->getShopperSiteCodes()[1]->value)->toBe('LY')
->and($dto->getRouteKey())->toBe(1)
->and($dto->getRouteKeyName())->toBe('setting')
->and($dto->resolveRouteBinding(1))->toBeNull()
->and($dto->resolveChildRouteBinding('child', 'val', 'field'))->toBeNull()
->and($dto->toArray())->toBe([
'id' => 1,
'employee_sites' => ['PA', 'LY'],
]);
});
});