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); }
public function testRemoveUser() { $uuid = new Uuid('112d2ed6-25b8-4e8b-a7e5-4f9a3f445314'); $user = $this->repository->find($uuid); $this->assertInstanceOf('App\\Domain\\User\\User', $user); $this->assertEquals(2, $this->repository->findAll()->count()); $this->repository->remove($user); $this->assertEquals(1, $this->repository->findAll()->count()); }