From 12a97c352275d81e9252ca4179de51180403eb6f Mon Sep 17 00:00:00 2001 From: Kevin Decherf Date: Sun, 17 Feb 2019 18:19:51 +0100 Subject: [PATCH] tests: fix broken session clients for rest entry deletion tests Signed-off-by: Kevin Decherf --- .../Controller/EntryRestControllerTest.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php index 1489a472..46b5f460 100644 --- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php @@ -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() -- 2.41.0