X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FTests%2FController%2FWallabagRestControllerTest.php;h=0ffe7fe626311d83da7754be64cb3576126810e3;hb=2691cf04384239c546e141af6cc3c22b210dae58;hp=4164e5161fb49defb23113b875920587a11d2543;hpb=1d14779154481b320e1c44fccf2558d8c9fa43a1;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php index 4164e516..0ffe7fe6 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php @@ -150,4 +150,33 @@ class WallabagRestControllerTest extends WallabagTestCase $this->assertEquals(404, $client->getResponse()->getStatusCode()); } + + public function testGetOneTag() + { + $client = $this->createClient(); + $client->request('GET', '/api/salts/admin.json'); + $salt = json_decode($client->getResponse()->getContent()); + + $headers = $this->generateHeaders('admin', 'test', $salt[0]); + + $tag = $client->getContainer() + ->get('doctrine.orm.entity_manager') + ->getRepository('WallabagCoreBundle:Tag') + ->findOneByLabel('foo'); + + if (!$tag) { + $this->markTestSkipped('No content found in db.'); + } + + $client->request('GET', '/api/tags/'.$tag->getLabel().'.json', array(), array(), $headers); + + $this->assertEquals(json_encode($tag), $client->getResponse()->getContent()); + + $this->assertTrue( + $client->getResponse()->headers->contains( + 'Content-Type', + 'application/json' + ) + ); + } }