From 10b3509757c704943aa9cdd69c1d02bedfa937a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 18 Nov 2016 15:09:21 +0100 Subject: Added http_status in Entry entity --- .../CoreBundle/Controller/EntryControllerTest.php | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'tests/Wallabag/CoreBundle/Controller') diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index bf4e0543..771903fe 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php @@ -961,4 +961,50 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertEquals(302, $client->getResponse()->getStatusCode()); $this->assertContains('/view/'.$content->getId(), $client->getResponse()->headers->get('location')); } + + public function testFilterOnHttpStatus() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/new'); + $form = $crawler->filter('form[name=entry]')->form(); + + $data = [ + 'entry[url]' => 'http://www.lemonde.fr/incorrect-url/', + ]; + + $client->submit($form, $data); + + $crawler = $client->request('GET', '/all/list'); + $form = $crawler->filter('button[id=submit-filter]')->form(); + + $data = [ + 'entry_filter[httpStatus]' => 404, + ]; + + $crawler = $client->submit($form, $data); + + $this->assertCount(1, $crawler->filter('div[class=entry]')); + + $crawler = $client->request('GET', '/new'); + $form = $crawler->filter('form[name=entry]')->form(); + + $data = [ + 'entry[url]' => 'http://www.nextinpact.com/news/101235-wallabag-alternative-libre-a-pocket-creuse-petit-a-petit-son-nid.htm', + ]; + + $client->submit($form, $data); + + $crawler = $client->request('GET', '/all/list'); + $form = $crawler->filter('button[id=submit-filter]')->form(); + + $data = [ + 'entry_filter[httpStatus]' => 200, + ]; + + $crawler = $client->submit($form, $data); + + $this->assertCount(1, $crawler->filter('div[class=entry]')); + } } -- cgit v1.2.3