X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FTests%2FController%2FEntryControllerTest.php;h=86a19f616e351490be7e640ada6233e79d8afdf9;hb=8ce32af61229eec8f4cc34b207273d47f60adc48;hp=24848eb2f15e0ff198bc57ab278749d89c635d12;hpb=a15692b1b736a6a1d3c50a5daffe08c16e6cc93b;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php index 24848eb2..86a19f61 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(); @@ -252,11 +252,83 @@ class EntryControllerTest extends WallabagCoreTestCase $data = array( 'entry_filter[readingTime][right_number]' => 11, - 'entry_filter[readingTime][left_number]' => 11 + 'entry_filter[readingTime][left_number]' => 11, ); $crawler = $client->submit($form, $data); $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'); + $client = $this->getClient(); + $crawler = $client->request('GET', '/config'); + + $form = $crawler->filter('button[id=config_save]')->form(); + + $data = array( + 'config[items_per_page]' => '1', + ); + + $client->submit($form, $data); + + $parameters = '?entry_filter%5BreadingTime%5D%5Bleft_number%5D=&entry_filter%5BreadingTime%5D%5Bright_number%5D='; + + $crawler = $client->request('GET', 'unread/list'.$parameters); + + $this->assertContains($parameters, $client->getResponse()->getContent()); + } + + public function testFilterOnDomainName() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/unread/list'); + $form = $crawler->filter('button[id=submit-filter]')->form(); + $data = array( + 'entry_filter[domainName]' => 'monde', + ); + + $crawler = $client->submit($form, $data); + $this->assertCount(1, $crawler->filter('div[class=entry]')); + + $form = $crawler->filter('button[id=submit-filter]')->form(); + $data = array( + 'entry_filter[domainName]' => 'wallabag', + ); + + $crawler = $client->submit($form, $data); + $this->assertCount(0, $crawler->filter('div[class=entry]')); + } }