diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-02-24 07:42:09 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-03-06 20:50:31 +0100 |
commit | 46bbd8d321e6a00131f0e6ed96fa6f3d693b3678 (patch) | |
tree | 331d511837716ec7a7956c35f51dc3a14a1ca11c /src/Wallabag/CoreBundle/Tests | |
parent | 6c87418ff013cfd03093c3f01e20518e580d80bb (diff) | |
download | wallabag-46bbd8d321e6a00131f0e6ed96fa6f3d693b3678.tar.gz wallabag-46bbd8d321e6a00131f0e6ed96fa6f3d693b3678.tar.zst wallabag-46bbd8d321e6a00131f0e6ed96fa6f3d693b3678.zip |
relation between tags and entries
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests')
-rw-r--r-- | src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php | 26 |
1 files changed, 26 insertions, 0 deletions
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 | |||
150 | 150 | ||
151 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | 151 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); |
152 | } | 152 | } |
153 | |||
154 | public function testGetTagsEntry() | ||
155 | { | ||
156 | $client = $this->createClient(); | ||
157 | $client->request('GET', '/api/salts/admin.json'); | ||
158 | $salt = json_decode($client->getResponse()->getContent()); | ||
159 | $headers = $this->generateHeaders('admin', 'test', $salt[0]); | ||
160 | |||
161 | $entry = $client->getContainer() | ||
162 | ->get('doctrine.orm.entity_manager') | ||
163 | ->getRepository('WallabagCoreBundle:Entry') | ||
164 | ->findOneWithTags(); | ||
165 | |||
166 | if (!$entry) { | ||
167 | $this->markTestSkipped('No content found in db.'); | ||
168 | } | ||
169 | |||
170 | $tags = array(); | ||
171 | foreach ($entry->getTags() as $tag) { | ||
172 | $tags[] = array('id' => $tag->getId(), 'label' => $tag->getLabel()); | ||
173 | } | ||
174 | |||
175 | $client->request('GET', '/api/entries/'.$entry->getId().'/tags', array(), array(), $headers); | ||
176 | |||
177 | $this->assertEquals(json_encode($tags), $client->getResponse()->getContent()); | ||
178 | } | ||
153 | } | 179 | } |