From 46bbd8d321e6a00131f0e6ed96fa6f3d693b3678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 24 Feb 2015 07:42:09 +0100 Subject: relation between tags and entries --- .../Controller/WallabagRestControllerTest.php | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/Wallabag/CoreBundle/Tests') diff --git a/src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php index 4164e516..d2390055 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php @@ -150,4 +150,30 @@ class WallabagRestControllerTest extends WallabagTestCase $this->assertEquals(404, $client->getResponse()->getStatusCode()); } + + 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]); + + $entry = $client->getContainer() + ->get('doctrine.orm.entity_manager') + ->getRepository('WallabagCoreBundle:Entry') + ->findOneWithTags(); + + if (!$entry) { + $this->markTestSkipped('No content found in db.'); + } + + $tags = array(); + foreach ($entry->getTags() as $tag) { + $tags[] = array('id' => $tag->getId(), 'label' => $tag->getLabel()); + } + + $client->request('GET', '/api/entries/'.$entry->getId().'/tags', array(), array(), $headers); + + $this->assertEquals(json_encode($tags), $client->getResponse()->getContent()); + } } -- cgit v1.2.3