X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FTests%2FController%2FWallabagRestControllerTest.php;h=d239005567b41b85eb140cf613dd5f814b1d4cb5;hb=46bbd8d321e6a00131f0e6ed96fa6f3d693b3678;hp=0ffe7fe626311d83da7754be64cb3576126810e3;hpb=2691cf04384239c546e141af6cc3c22b210dae58;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php index 0ffe7fe6..d2390055 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php @@ -151,32 +151,29 @@ class WallabagRestControllerTest extends WallabagTestCase $this->assertEquals(404, $client->getResponse()->getStatusCode()); } - public function testGetOneTag() + public function testGetTagsEntry() { $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() + $entry = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Tag') - ->findOneByLabel('foo'); + ->getRepository('WallabagCoreBundle:Entry') + ->findOneWithTags(); - if (!$tag) { + if (!$entry) { $this->markTestSkipped('No content found in db.'); } - $client->request('GET', '/api/tags/'.$tag->getLabel().'.json', array(), array(), $headers); + $tags = array(); + foreach ($entry->getTags() as $tag) { + $tags[] = array('id' => $tag->getId(), 'label' => $tag->getLabel()); + } - $this->assertEquals(json_encode($tag), $client->getResponse()->getContent()); + $client->request('GET', '/api/entries/'.$entry->getId().'/tags', array(), array(), $headers); - $this->assertTrue( - $client->getResponse()->headers->contains( - 'Content-Type', - 'application/json' - ) - ); + $this->assertEquals(json_encode($tags), $client->getResponse()->getContent()); } }