From 7b150dcd266dbe9e2732737d7a60d3500e4044ef Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 17 Oct 2022 21:37:08 +0200 Subject: [PATCH] Add tests --- .../Controller/EntryRestControllerTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php index c058c52f7..c18ea30ab 100644 --- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php @@ -157,6 +157,25 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); } + public function testGetEntriesByDomainName() + { + $this->client->request('GET', '/api/entries?domain_name=domain.io'); + + $this->assertSame(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->assertSame(1, $content['page']); + $this->assertGreaterThanOrEqual(1, $content['pages']); + + $this->assertSame('test title entry6', $content['_embedded']['items'][0]['title']); + + $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); + } + public function testGetEntriesWithFullOptions() { $this->client->request('GET', '/api/entries', [