From 78e3fafa3fab86638295fe1ee2a05a559bf56ab1 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 14 Jan 2019 17:01:21 +0100 Subject: Avoid error when a bad `order` parameter is given Only allowed parameter are asc & desc --- tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/Wallabag/ApiBundle/Controller') diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php index 58b617f3..2a1d2e15 100644 --- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php @@ -242,6 +242,15 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->assertSame(2, $content['limit']); } + public function testGetStarredEntriesWithBadSort() + { + $this->client->request('GET', '/api/entries', ['starred' => 1, 'sort' => 'updated', 'order' => 'unknown']); + + $this->assertSame(400, $this->client->getResponse()->getStatusCode()); + + $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); + } + public function testGetStarredEntries() { $this->client->request('GET', '/api/entries', ['starred' => 1, 'sort' => 'updated']); -- cgit v1.2.3