matricule)->toBe($matricule) ->and($employee->firstname)->toBe('John') ->and($employee->lastname)->toBe('Doe') ->and($employee->facility)->toBe('Facility') ->and($employee->site)->toBe('Site') ->and($employee->service)->toBe('Service'); }); it('throws exception if firstname is empty', function (): void { // GIVEN // WHEN $action = fn () => new OrderEmployee(new Matricule('1234567'), '', 'Doe', 'Facility', 'Site', 'Service'); // THEN expect($action)->toThrow(\DomainException::class, 'firstname cannot be empty'); }); it('throws exception if lastname is empty', function (): void { // GIVEN // WHEN $action = fn () => new OrderEmployee(new Matricule('1234567'), 'John', '', 'Facility', 'Site', 'Service'); // THEN expect($action)->toThrow(\DomainException::class, 'lastname cannot be empty'); }); it('throws exception if facility is empty', function (): void { // GIVEN // WHEN $action = fn () => new OrderEmployee(new Matricule('1234567'), 'John', 'Doe', '', 'Site', 'Service'); // THEN expect($action)->toThrow(\DomainException::class, 'facility cannot be empty'); }); it('throws exception if site is empty', function (): void { // GIVEN // WHEN $action = fn () => new OrderEmployee(new Matricule('1234567'), 'John', 'Doe', 'Facility', '', 'Service'); // THEN expect($action)->toThrow(\DomainException::class, 'site cannot be empty'); }); it('throws exception if service is empty', function (): void { // GIVEN // WHEN $action = fn () => new OrderEmployee(new Matricule('1234567'), 'John', 'Doe', 'Facility', 'Site', ''); // THEN expect($action)->toThrow(\DomainException::class, 'service cannot be empty'); }); });