X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FWallabag%2FCoreBundle%2FController%2FEntryControllerTest.php;h=c347cca5ad2ab05ba2acb3783fa432fd2ad13307;hb=68cb89a5161351dd730871fc834bf147204a2a07;hp=09cf01b8c51e8e90882fa72112db9ef8bb93ebb0;hpb=d215273c65ed7aecf0a1f887c91752eaf41d191b;p=github%2Fwallabag%2Fwallabag.git diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 09cf01b8..c347cca5 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php @@ -725,6 +725,15 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->submit($form, $data); $this->assertCount(5, $crawler->filter('div[class=entry]')); + $crawler = $client->request('GET', '/unread/list'); + $form = $crawler->filter('button[id=submit-filter]')->form(); + $data = [ + 'entry_filter[domainName]' => 'dOmain', + ]; + + $crawler = $client->submit($form, $data); + $this->assertCount(5, $crawler->filter('div[class=entry]')); + $form = $crawler->filter('button[id=submit-filter]')->form(); $data = [ 'entry_filter[domainName]' => 'wallabag', @@ -1018,4 +1027,71 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertCount(7, $crawler->filter('div[class=entry]')); } + + public function testSearch() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + // Search on unread list + $crawler = $client->request('GET', '/unread/list'); + + $form = $crawler->filter('form[name=search]')->form(); + $data = [ + 'search_entry[term]' => 'title', + ]; + + $crawler = $client->submit($form, $data); + + $this->assertCount(5, $crawler->filter('div[class=entry]')); + + // Search on starred list + $crawler = $client->request('GET', '/starred/list'); + + $form = $crawler->filter('form[name=search]')->form(); + $data = [ + 'search_entry[term]' => 'title', + ]; + + $crawler = $client->submit($form, $data); + + $this->assertCount(1, $crawler->filter('div[class=entry]')); + + // Added new article to test on archive list + $crawler = $client->request('GET', '/new'); + $form = $crawler->filter('form[name=entry]')->form(); + $data = [ + 'entry[url]' => $this->url, + ]; + $client->submit($form, $data); + $content = $client->getContainer() + ->get('doctrine.orm.entity_manager') + ->getRepository('WallabagCoreBundle:Entry') + ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); + $client->request('GET', '/archive/'.$content->getId()); + + $crawler = $client->request('GET', '/archive/list'); + + $form = $crawler->filter('form[name=search]')->form(); + $data = [ + 'search_entry[term]' => 'manège', + ]; + + $crawler = $client->submit($form, $data); + + $this->assertCount(1, $crawler->filter('div[class=entry]')); + $client->request('GET', '/delete/'.$content->getId()); + + // test on list of all articles + $crawler = $client->request('GET', '/all/list'); + + $form = $crawler->filter('form[name=search]')->form(); + $data = [ + 'search_entry[term]' => 'wxcvbnqsdf', // a string not available in the database + ]; + + $crawler = $client->submit($form, $data); + + $this->assertCount(0, $crawler->filter('div[class=entry]')); + } }