matricule)->toBe($matricule) ->and($import->nom)->toBe('Doe') ->and($import->prenom)->toBe('John') ->and($import->etablissement)->toBe('Etab') ->and($import->service)->toBe('Serv') ->and($import->site)->toBe('Site') ->and($import->startDate)->toBe($date) ->and($import->endDate)->toBeNull(); }); it('throws exception if nom is empty', function (): void { // GIVEN // WHEN $action = fn () => new EmployeeImport(new Matricule('1234567'), '', 'John', 'Etab', 'Serv', 'Site', CarbonImmutable::now(), null); // THEN expect($action)->toThrow(\DomainException::class, 'Name is required'); }); it('throws exception if prenom is empty', function (): void { // GIVEN // WHEN $action = fn () => new EmployeeImport(new Matricule('1234567'), 'Doe', '', 'Etab', 'Serv', 'Site', CarbonImmutable::now(), null); // THEN expect($action)->toThrow(\DomainException::class, 'First name is required'); }); it('throws exception if etablissement is empty', function (): void { // GIVEN // WHEN $action = fn () => new EmployeeImport(new Matricule('1234567'), 'Doe', 'John', '', 'Serv', 'Site', CarbonImmutable::now(), null); // THEN expect($action)->toThrow(\DomainException::class, 'The establishment is required'); }); it('throws exception if service is empty', function (): void { // GIVEN // WHEN $action = fn () => new EmployeeImport(new Matricule('1234567'), 'Doe', 'John', 'Etab', '', 'Site', CarbonImmutable::now(), null); // THEN expect($action)->toThrow(\DomainException::class, 'The service is required'); }); it('throws exception if site is empty', function (): void { // GIVEN // WHEN $action = fn () => new EmployeeImport(new Matricule('1234567'), 'Doe', 'John', 'Etab', 'Serv', '', CarbonImmutable::now(), null); // THEN expect($action)->toThrow(\DomainException::class, 'The site is required'); }); });