aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2015-02-20 16:38:24 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2015-03-06 20:50:30 +0100
commit2691cf04384239c546e141af6cc3c22b210dae58 (patch)
tree0e3f7047e7edb9628139a7f344ea646f660ac14d /src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php
parent1d14779154481b320e1c44fccf2558d8c9fa43a1 (diff)
downloadwallabag-2691cf04384239c546e141af6cc3c22b210dae58.tar.gz
wallabag-2691cf04384239c546e141af6cc3c22b210dae58.tar.zst
wallabag-2691cf04384239c546e141af6cc3c22b210dae58.zip
GET /api/tags/id_tag method
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php')
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/WallabagRestControllerTest.php29
1 files changed, 29 insertions, 0 deletions
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
150 150
151 $this->assertEquals(404, $client->getResponse()->getStatusCode()); 151 $this->assertEquals(404, $client->getResponse()->getStatusCode());
152 } 152 }
153
154 public function testGetOneTag()
155 {
156 $client = $this->createClient();
157 $client->request('GET', '/api/salts/admin.json');
158 $salt = json_decode($client->getResponse()->getContent());
159
160 $headers = $this->generateHeaders('admin', 'test', $salt[0]);
161
162 $tag = $client->getContainer()
163 ->get('doctrine.orm.entity_manager')
164 ->getRepository('WallabagCoreBundle:Tag')
165 ->findOneByLabel('foo');
166
167 if (!$tag) {
168 $this->markTestSkipped('No content found in db.');
169 }
170
171 $client->request('GET', '/api/tags/'.$tag->getLabel().'.json', array(), array(), $headers);
172
173 $this->assertEquals(json_encode($tag), $client->getResponse()->getContent());
174
175 $this->assertTrue(
176 $client->getResponse()->headers->contains(
177 'Content-Type',
178 'application/json'
179 )
180 );
181 }
153} 182}