1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-08-01 17:38:38 +00:00

Avoid error when a bad order parameter is given

Only allowed parameter are asc & desc
This commit is contained in:
Jeremy Benoist 2019-01-14 17:01:21 +01:00
parent a5e9a98aa3
commit 78e3fafa3f
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
3 changed files with 32 additions and 14 deletions

View file

@ -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']);