コード例 #1
0
 public function testEmptyUserList()
 {
     $users = $this->repository->findAll();
     foreach ($users as $user) {
         $this->repository->remove($user);
     }
     // Make sure there are no users
     $this->assertEquals(0, $this->repository->findAll()->count());
     $request = $this->request->withUri(new Uri('http://localhost/api/users'))->withMethod('GET');
     $response = $this->app->__invoke($request, new Response());
     $data = json_decode((string) $response->getBody(), true);
     $this->assertEquals(204, $response->getStatusCode());
     $this->assertEquals('application/json', $response->getHeaderLine('Content-Type'));
     $this->assertEmpty($data);
 }
 /**
  * @expectedException \App\Repository\Exception\UserNotFoundException
  */
 public function testShouldThrowExceptionWhenRemovingUnknownUser()
 {
     $user = new User(new Uuid('badfdcad-1ad5-42fb-8da6-4a2db08c6941'), new Username('joker'), new Email('*****@*****.**'), new Password('rofl'));
     $this->repository->remove($user);
 }