diff options
Diffstat (limited to 'tests/Wallabag')
-rw-r--r-- | tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php | 16 | ||||
-rw-r--r-- | tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | 20 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php index deafd1fa..0a65f9ce 100644 --- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php | |||
@@ -157,6 +157,22 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
157 | $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); | 157 | $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); |
158 | } | 158 | } |
159 | 159 | ||
160 | public function testGetEntriesOnPageTwo() | ||
161 | { | ||
162 | $this->client->request('GET', '/api/entries', [ | ||
163 | 'page' => 2, | ||
164 | 'perPage' => 2, | ||
165 | ]); | ||
166 | |||
167 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | ||
168 | |||
169 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
170 | |||
171 | $this->assertGreaterThanOrEqual(0, $content['total']); | ||
172 | $this->assertEquals(2, $content['page']); | ||
173 | $this->assertEquals(2, $content['limit']); | ||
174 | } | ||
175 | |||
160 | public function testGetStarredEntries() | 176 | public function testGetStarredEntries() |
161 | { | 177 | { |
162 | $this->client->request('GET', '/api/entries', ['starred' => 1, 'sort' => 'updated']); | 178 | $this->client->request('GET', '/api/entries', ['starred' => 1, 'sort' => 'updated']); |
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 3eb6d47f..7db4cf1f 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | |||
@@ -591,6 +591,26 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
591 | $this->assertCount(1, $crawler->filter('div[class=entry]')); | 591 | $this->assertCount(1, $crawler->filter('div[class=entry]')); |
592 | } | 592 | } |
593 | 593 | ||
594 | public function testFilterOnReadingTimeWithNegativeValue() | ||
595 | { | ||
596 | $this->logInAs('admin'); | ||
597 | $client = $this->getClient(); | ||
598 | |||
599 | $crawler = $client->request('GET', '/unread/list'); | ||
600 | |||
601 | $form = $crawler->filter('button[id=submit-filter]')->form(); | ||
602 | |||
603 | $data = [ | ||
604 | 'entry_filter[readingTime][right_number]' => -22, | ||
605 | 'entry_filter[readingTime][left_number]' => -22, | ||
606 | ]; | ||
607 | |||
608 | $crawler = $client->submit($form, $data); | ||
609 | |||
610 | // forcing negative value results in no entry displayed | ||
611 | $this->assertCount(0, $crawler->filter('div[class=entry]')); | ||
612 | } | ||
613 | |||
594 | public function testFilterOnReadingTimeOnlyUpper() | 614 | public function testFilterOnReadingTimeOnlyUpper() |
595 | { | 615 | { |
596 | $this->logInAs('admin'); | 616 | $this->logInAs('admin'); |