employee_sites = ['PA', 'LY']; $setting->saveOrFail(); $logger = app(LoggerInterface::class); $codeService = app(CodeGenerationService::class); $storageService = \Mockery::mock(EmployeeImportStorageService::class); $employee = new ArcadiaEmployee( matricule: new Matricule('1234567'), lastname: 'Dupont', firstname: 'Jean', startDate: CarbonImmutable::parse('2026-01-01'), endDate: null, etablissement: new ShopperEstablishmentCode('ETAB'), site: new ShopperSiteCode('PA'), service: new ShopperServiceCode('101') ); $storageService->shouldReceive('upsertEmployees') ->once() ->with(\Mockery::on(static function (array $data): bool { return count($data) === 1 && $data[0]->matricule->value === '1234567'; })); $storageService->shouldReceive('getImportedAfter') ->once() ->andReturn((object) [ 'insertedCount' => 1, 'updatedCount' => 0, 'matriculesInserted' => [new Matricule('1234567')], ]); $service = new EmployeeUpsertService( $logger, $codeService, $storageService, ); // WHEN $result = $service->upsertEmployees([$employee]); // THEN expect($result)->toBeInstanceOf(EmployeeUpsertServiceResult::class); }); });