]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Add test on getting starred entries using the API
authorJeremy Benoist <jeremy.benoist@gmail.com>
Thu, 20 Aug 2015 18:36:08 +0000 (20:36 +0200)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Thu, 20 Aug 2015 18:39:26 +0000 (20:39 +0200)
src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php

index 86c8de1ed0eb8d5d5352d5289af535b972b15a45..7ae54b576d577014bb3f5348235986973fc2b439 100644 (file)
@@ -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());