From 3f357ee2412e8f25df8a2813e2ba8ff20fb02f89 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 18 Aug 2015 16:33:32 +0200 Subject: [PATCH] add test --- .../Tests/Controller/EntryControllerTest.php | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php index 0bd18c44..87c16415 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php @@ -241,7 +241,7 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertEquals(403, $client->getResponse()->getStatusCode()); } - public function testFilterOnUnreadeView() + public function testFilterOnReadingTime() { $this->logInAs('admin'); $client = $this->getClient(); @@ -260,6 +260,35 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertCount(1, $crawler->filter('div[class=entry]')); } + public function testFilterOnCreationDate() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/unread/list'); + + $form = $crawler->filter('button[id=submit-filter]')->form(); + + $data = array( + 'entry_filter[createdAt][left_date]' => date('d/m/Y'), + 'entry_filter[createdAt][right_date]' => date('d/m/Y', strtotime("+1 day")) + ); + + $crawler = $client->submit($form, $data); + + $this->assertCount(4, $crawler->filter('div[class=entry]')); + + $data = array( + 'entry_filter[createdAt][left_date]' => '01/01/1970', + 'entry_filter[createdAt][right_date]' => '01/01/1970' + ); + + $crawler = $client->submit($form, $data); + + $this->assertCount(0, $crawler->filter('div[class=entry]')); + + } + public function testPaginationWithFilter() { $this->logInAs('admin'); -- 2.41.0