]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
Added migrations execution after fresh install
[github/wallabag/wallabag.git] / tests / Wallabag / ApiBundle / Controller / EntryRestControllerTest.php
index 88a5be93b66d2adbf987e05b8a1a692c7de2dc3a..362c269b40544bf7541ee12720a354d23e201c73 100644 (file)
@@ -337,7 +337,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $this->assertEquals(false, $content['is_starred']);
         $this->assertEquals('New title for my article', $content['title']);
         $this->assertEquals(1, $content['user_id']);
-        $this->assertCount(1, $content['tags']);
+        $this->assertCount(2, $content['tags']);
     }
 
     public function testPostSameEntry()
@@ -356,7 +356,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $this->assertEquals('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']);
         $this->assertEquals(true, $content['is_archived']);
         $this->assertEquals(false, $content['is_starred']);
-        $this->assertCount(2, $content['tags']);
+        $this->assertCount(3, $content['tags']);
     }
 
     public function testPostArchivedAndStarredEntry()
@@ -766,10 +766,9 @@ class EntryRestControllerTest extends WallabagApiTestCase
             ],
         ];
 
-        $this->client->request('DELETE', '/api/entries/tags/list?list=' . json_encode($list));
+        $this->client->request('DELETE', '/api/entries/tags/list?list='.json_encode($list));
     }
 
-
     public function testPostEntriesListAction()
     {
         $list = [
@@ -809,4 +808,26 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $this->assertFalse($content[1]['entry']);
         $this->assertEquals('http://0.0.0.0/entry3', $content[1]['url']);
     }
+
+    public function testLimitBulkAction()
+    {
+        $list = [
+            'http://0.0.0.0/entry1',
+            'http://0.0.0.0/entry1',
+            'http://0.0.0.0/entry1',
+            'http://0.0.0.0/entry1',
+            'http://0.0.0.0/entry1',
+            'http://0.0.0.0/entry1',
+            'http://0.0.0.0/entry1',
+            'http://0.0.0.0/entry1',
+            'http://0.0.0.0/entry1',
+            'http://0.0.0.0/entry1',
+            'http://0.0.0.0/entry1',
+        ];
+
+        $this->client->request('POST', '/api/entries/lists?urls='.json_encode($list));
+
+        $this->assertEquals(400, $this->client->getResponse()->getStatusCode());
+        $this->assertContains('API limit reached', $this->client->getResponse()->getContent());
+    }
 }