ldc-cocotte/tests/Unit/App/Dto/SettingDtoTest.php
Jérémy Munsch 3b3997d547
feat(employees): automated sync with Arcadia API, BO settings, Shopper value objects, and pagination migration
- Implement automated synchronization of employees via Arcadia API (EmployeeSyncService, SynchronizeEmployeesWithArcadiaApi, FetchAndUpsertArcadiaEmployees)
- Add Back-Office application settings for employee sites (Setting singleton, GetSettingsQuery, UpdateSettings, SettingsController, EmployeeSitesInputComponent.vue)
- Strongly type Employee attributes using Domain Value Objects (ShopperEstablishmentCode, ShopperSiteCode, ShopperServiceCode) and Eloquent Casts
- Migrate pagination from Domain to Shared\Pagination namespace across queries and inputs
- Remove legacy and dead CSV employee import/export code
- Restore Domain\Ports\Services\CsvGenerator interface for Regate order generation
- Add comprehensive Pest unit, integration, and feature test coverage
2026-10-27 09:58:44 +01:00

37 lines
1.4 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->arcadiaSites)->toBe(['PA', 'LY'])
->and($dto->employeeSitesAsString())->toBe('PA, LY')
->and($dto->arcadiaSitesAsString())->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'],
'arcadia_sites' => ['PA', 'LY'],
]);
});
});