shouldReceive('find') ->once() ->with($employeeId) ->andReturn($employee); // WHEN $result = $usecase->execute($input); // THEN expect($result)->toBeInstanceOf(Output::class) ->and($result->id)->toBe($employeeId) ->and($result->firstName)->toBe('John') ->and($result->lastName)->toBe('DOE') ->and($result->establishment)->toBe('EST01') ->and($result->site)->toBe('LDCSER') ->and($result->service)->toBe('097'); }); it('throws NotFoundException when employee does not exist', function (): void { // GIVEN $employeeId = new ArcadiaEmployeeId('01155902'); $input = new Input($employeeId); $employeeDirectory = \Mockery::mock(EmployeeDirectory::class); $usecase = new FindEmployee($employeeDirectory); $employeeDirectory->shouldReceive('find') ->once() ->with($employeeId) ->andReturnNull(); // WHEN & THEN expect(fn () => $usecase->execute($input)) ->toThrow(NotFoundException::class, "Employee '01155902' not found."); }); });