]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
tests: fix broken session clients for rest entry deletion tests
[github/wallabag/wallabag.git] / tests / Wallabag / ApiBundle / Controller / EntryRestControllerTest.php
index 1489a4722bc67964b7fcbf61469685def1be7280..46b5f460e984f4c4c988d3ca1465a6be08708fdc 100644 (file)
@@ -426,9 +426,10 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $this->assertSame($e['id'], $content['id']);
 
         // We'll try to delete this entry again
-        $this->client->request('DELETE', '/api/entries/' . $e['id'] . '.json');
+        $client = $this->createAuthorizedClient();
+        $client->request('DELETE', '/api/entries/' . $e['id'] . '.json');
 
-        $this->assertSame(404, $this->client->getResponse()->getStatusCode());
+        $this->assertSame(404, $client->getResponse()->getStatusCode());
     }
 
     public function testDeleteEntryExpectId()
@@ -453,9 +454,17 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $this->assertArrayNotHasKey('url', $content);
 
         // We'll try to delete this entry again
-        $this->client->request('DELETE', '/api/entries/' . $id . '.json');
+        $client = $this->createAuthorizedClient();
+        $client->request('DELETE', '/api/entries/' . $id . '.json');
+
+        $this->assertSame(404, $client->getResponse()->getStatusCode());
+    }
+
+    public function testDeleteEntryExpectBadRequest()
+    {
+        $this->client->request('DELETE', '/api/entries/1.json?expect=badrequest');
 
-        $this->assertSame(404, $this->client->getResponse()->getStatusCode());
+        $this->assertSame(400, $this->client->getResponse()->getStatusCode());
     }
 
     public function testPostEntry()