/** * Test UserServiceContract::getFilteredListOfUsers(FilterContract $filter). * * @return void */ public function testGetFilteredListOfUsers() { $mockUsers = $this->getMockUser(5); $mockQuery = $this->getMockQuery(); $mockFilter = $this->getMockFilter(); $mockRepository = $this->getMockUserRepository(); $mockRepository->shouldReceive('withQuery')->once()->with($mockQuery)->andReturn($mockRepository); $mockRepository->shouldReceive('withFilter')->once()->with($mockFilter)->andReturn($mockRepository); $mockRepository->shouldReceive('findAll')->once()->andReturn($mockUsers); $service = new UserService($mockRepository); $users = $service->getFilteredListOfUsers($mockFilter); $this->assertEquals($users, $mockUsers, 'getFilteredListOfUsers(FilterContract $filter) returned an invalid result'); }