From 28803f106bd091b5a7540a134cba2545d12d25ea Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sat, 25 Jun 2016 16:27:38 +0200 Subject: Add filter for tags on API --- .../Controller/WallabagRestControllerTest.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php') diff --git a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php index f256a7f9..528366af 100644 --- a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php @@ -121,6 +121,28 @@ class WallabagRestControllerTest extends WallabagApiTestCase ); } + public function testGetTaggedEntries() + { + $this->client->request('GET', '/api/entries', ['tags' => 'foo,bar']); + + $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + + $content = json_decode($this->client->getResponse()->getContent(), true); + + $this->assertGreaterThanOrEqual(1, count($content)); + $this->assertNotEmpty($content['_embedded']['items']); + $this->assertGreaterThanOrEqual(1, $content['total']); + $this->assertEquals(1, $content['page']); + $this->assertGreaterThanOrEqual(1, $content['pages']); + + $this->assertTrue( + $this->client->getResponse()->headers->contains( + 'Content-Type', + 'application/json' + ) + ); + } + public function testGetDatedEntries() { $this->client->request('GET', '/api/entries', ['since' => 1]); -- cgit v1.2.3