]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
tests: fix broken session clients for rest entry deletion tests 3887/head
authorKevin Decherf <kevin@kdecherf.com>
Sun, 17 Feb 2019 17:19:51 +0000 (18:19 +0100)
committerKevin Decherf <kevin@kdecherf.com>
Wed, 20 Feb 2019 14:57:56 +0000 (15:57 +0100)
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
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()