From: Jeremy Benoist Date: Thu, 20 Aug 2015 18:36:08 +0000 (+0200) Subject: Add test on getting starred entries using the API X-Git-Tag: 2.0.0-alpha.0~17^2~1 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=e6f55346fd44911b0763720676481e65dfd35f84;p=github%2Fwallabag%2Fwallabag.git Add test on getting starred entries using the API --- 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 $client = $this->createClient(); $headers = $this->generateHeaders('admin', 'mypassword'); + $client->request('GET', '/api/entries', array('star' => 1, 'sort' => 'updated'), array(), $headers); + + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + + $content = json_decode($client->getResponse()->getContent(), true); + + $this->assertGreaterThanOrEqual(1, count($content)); + $this->assertNotEmpty($content['_embedded']['items']); + $this->assertGreaterThanOrEqual(1, $content['total']); + $this->assertEquals(1, $content['page']); + $this->assertGreaterThanOrEqual(1, $content['pages']); + + $this->assertTrue( + $client->getResponse()->headers->contains( + 'Content-Type', + 'application/json' + ) + ); + } + + public function testGetArchiveEntries() + { + $client = $this->createClient(); + $headers = $this->generateHeaders('admin', 'mypassword'); + $client->request('GET', '/api/entries', array('archive' => 1), array(), $headers); $this->assertEquals(200, $client->getResponse()->getStatusCode());