public function testFindAllShouldReturnAllClients()
 {
     $newClient1 = new Client('foo');
     $newClient2 = new Client('bar');
     $addedClient1 = $this->repository->add($newClient1);
     $addedClient2 = $this->repository->add($newClient2);
     $this->assertEquals([f\get($addedClient1, 'id') => $addedClient1, f\get($addedClient2, 'id') => $addedClient2], $this->repository->findAll());
 }
Exemplo n.º 2
0
 private function findClientByName($name)
 {
     $clients = $this->clientRepository->findAll();
     foreach ($clients as $client) {
         if (f\get($client, 'id') === $name) {
             return $client;
         }
     }
     throw new \Exception(sprintf('The client "%s" does not exist.', $name));
 }