diff options
Diffstat (limited to 'tests/Wallabag/CoreBundle/Controller')
-rw-r--r-- | tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index bf4e0543..09cf01b8 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | |||
@@ -961,4 +961,61 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
961 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 961 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
962 | $this->assertContains('/view/'.$content->getId(), $client->getResponse()->headers->get('location')); | 962 | $this->assertContains('/view/'.$content->getId(), $client->getResponse()->headers->get('location')); |
963 | } | 963 | } |
964 | |||
965 | public function testFilterOnHttpStatus() | ||
966 | { | ||
967 | $this->logInAs('admin'); | ||
968 | $client = $this->getClient(); | ||
969 | |||
970 | $crawler = $client->request('GET', '/new'); | ||
971 | $form = $crawler->filter('form[name=entry]')->form(); | ||
972 | |||
973 | $data = [ | ||
974 | 'entry[url]' => 'http://www.lemonde.fr/incorrect-url/', | ||
975 | ]; | ||
976 | |||
977 | $client->submit($form, $data); | ||
978 | |||
979 | $crawler = $client->request('GET', '/all/list'); | ||
980 | $form = $crawler->filter('button[id=submit-filter]')->form(); | ||
981 | |||
982 | $data = [ | ||
983 | 'entry_filter[httpStatus]' => 404, | ||
984 | ]; | ||
985 | |||
986 | $crawler = $client->submit($form, $data); | ||
987 | |||
988 | $this->assertCount(1, $crawler->filter('div[class=entry]')); | ||
989 | |||
990 | $crawler = $client->request('GET', '/new'); | ||
991 | $form = $crawler->filter('form[name=entry]')->form(); | ||
992 | |||
993 | $data = [ | ||
994 | 'entry[url]' => 'http://www.nextinpact.com/news/101235-wallabag-alternative-libre-a-pocket-creuse-petit-a-petit-son-nid.htm', | ||
995 | ]; | ||
996 | |||
997 | $client->submit($form, $data); | ||
998 | |||
999 | $crawler = $client->request('GET', '/all/list'); | ||
1000 | $form = $crawler->filter('button[id=submit-filter]')->form(); | ||
1001 | |||
1002 | $data = [ | ||
1003 | 'entry_filter[httpStatus]' => 200, | ||
1004 | ]; | ||
1005 | |||
1006 | $crawler = $client->submit($form, $data); | ||
1007 | |||
1008 | $this->assertCount(1, $crawler->filter('div[class=entry]')); | ||
1009 | |||
1010 | $crawler = $client->request('GET', '/all/list'); | ||
1011 | $form = $crawler->filter('button[id=submit-filter]')->form(); | ||
1012 | |||
1013 | $data = [ | ||
1014 | 'entry_filter[httpStatus]' => 1024, | ||
1015 | ]; | ||
1016 | |||
1017 | $crawler = $client->submit($form, $data); | ||
1018 | |||
1019 | $this->assertCount(7, $crawler->filter('div[class=entry]')); | ||
1020 | } | ||
964 | } | 1021 | } |