diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2015-08-20 20:36:08 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2015-08-20 20:39:26 +0200 |
commit | e6f55346fd44911b0763720676481e65dfd35f84 (patch) | |
tree | 1d8117e5ecccae5a75ad781183af8fc53b1a3e8e /src | |
parent | eccf5eb2e0b7b10b274d00e616d1d9a7e56caffe (diff) | |
download | wallabag-e6f55346fd44911b0763720676481e65dfd35f84.tar.gz wallabag-e6f55346fd44911b0763720676481e65dfd35f84.tar.zst wallabag-e6f55346fd44911b0763720676481e65dfd35f84.zip |
Add test on getting starred entries using the API
Diffstat (limited to 'src')
-rw-r--r-- | src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php b/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php index 86c8de1e..7ae54b57 100644 --- a/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php +++ b/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php | |||
@@ -170,6 +170,31 @@ class WallabagRestControllerTest extends WebTestCase | |||
170 | $client = $this->createClient(); | 170 | $client = $this->createClient(); |
171 | $headers = $this->generateHeaders('admin', 'mypassword'); | 171 | $headers = $this->generateHeaders('admin', 'mypassword'); |
172 | 172 | ||
173 | $client->request('GET', '/api/entries', array('star' => 1, 'sort' => 'updated'), array(), $headers); | ||
174 | |||
175 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
176 | |||
177 | $content = json_decode($client->getResponse()->getContent(), true); | ||
178 | |||
179 | $this->assertGreaterThanOrEqual(1, count($content)); | ||
180 | $this->assertNotEmpty($content['_embedded']['items']); | ||
181 | $this->assertGreaterThanOrEqual(1, $content['total']); | ||
182 | $this->assertEquals(1, $content['page']); | ||
183 | $this->assertGreaterThanOrEqual(1, $content['pages']); | ||
184 | |||
185 | $this->assertTrue( | ||
186 | $client->getResponse()->headers->contains( | ||
187 | 'Content-Type', | ||
188 | 'application/json' | ||
189 | ) | ||
190 | ); | ||
191 | } | ||
192 | |||
193 | public function testGetArchiveEntries() | ||
194 | { | ||
195 | $client = $this->createClient(); | ||
196 | $headers = $this->generateHeaders('admin', 'mypassword'); | ||
197 | |||
173 | $client->request('GET', '/api/entries', array('archive' => 1), array(), $headers); | 198 | $client->request('GET', '/api/entries', array('archive' => 1), array(), $headers); |
174 | 199 | ||
175 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 200 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |