diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/UserApiControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/UserApiControllerTest.php new file mode 100644 index 000000000..85d9895fc --- /dev/null +++ b/src/Bundle/ChillMainBundle/Tests/Controller/UserApiControllerTest.php @@ -0,0 +1,49 @@ +getClientAuthenticated(); + + $client->request(Request::METHOD_GET, '/api/1.0/main/user.json'); + + $this->assertResponseIsSuccessful(); + + $data = \json_decode($client->getResponse()->getContent(), true); + $this->assertTrue(\array_key_exists('count', $data)); + $this->assertGreaterThan(0, $data['count']); + $this->assertTrue(\array_key_exists('results', $data)); + + return $data['results'][0]; + } + + /** + * @depends testIndex + */ + public function testEntity($existingUser) + { + $client = $this->getClientAuthenticated(); + + $client->request(Request::METHOD_GET, '/api/1.0/main/user/'.$existingUser['id'].'.json'); + + $this->assertResponseIsSuccessful(); + } + + public function testWhoami() + { + $client = $this->getClientAuthenticated(); + + $client->request(Request::METHOD_GET, '/api/1.0/main/whoami.json'); + + $this->assertResponseIsSuccessful(); + } +}