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
43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Actions\Settings\UpdateSettingsInput;
|
|
use Domain\Models\ValueObjects\ShopperSiteCode;
|
|
|
|
describe('UpdateSettingsInput', function (): void {
|
|
it('creates an input with valid ShopperSiteCode objects', function (): void {
|
|
// GIVEN
|
|
$sites = [
|
|
new ShopperSiteCode('PA'),
|
|
new ShopperSiteCode('LY'),
|
|
];
|
|
|
|
// WHEN
|
|
$input = new UpdateSettingsInput(employeeSites: $sites);
|
|
|
|
// THEN
|
|
expect($input->employeeSites)->toBe($sites);
|
|
});
|
|
|
|
it('creates an empty input', function (): void {
|
|
// GIVEN
|
|
$sites = [];
|
|
|
|
// WHEN
|
|
$input = new UpdateSettingsInput(employeeSites: $sites);
|
|
|
|
// THEN
|
|
expect($input->employeeSites)->toBeEmpty();
|
|
});
|
|
|
|
it('throws when site elements are not ShopperSiteCode', function (): void {
|
|
// GIVEN
|
|
$invalidSites = ['PA', 'LY'];
|
|
|
|
// WHEN / THEN
|
|
/** @phpstan-ignore argument.type */
|
|
expect(fn () => new UpdateSettingsInput(employeeSites: $invalidSites))
|
|
->toThrow(\InvalidArgumentException::class);
|
|
});
|
|
});
|