aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-11-18 15:09:21 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2016-11-18 15:09:21 +0100
commit10b3509757c704943aa9cdd69c1d02bedfa937a3 (patch)
tree2fee613487ecea37a2b938611dd3711248774818 /tests
parentb060fbdfe763bf4fa2b17d43bccc6751cefd0d2c (diff)
downloadwallabag-10b3509757c704943aa9cdd69c1d02bedfa937a3.tar.gz
wallabag-10b3509757c704943aa9cdd69c1d02bedfa937a3.tar.zst
wallabag-10b3509757c704943aa9cdd69c1d02bedfa937a3.zip
Added http_status in Entry entity
Diffstat (limited to 'tests')
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php46
-rw-r--r--tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php4
2 files changed, 50 insertions, 0 deletions
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
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 }
964} 1010}
diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
index 5d772602..33b3ff2a 100644
--- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
@@ -97,6 +97,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
97 'url' => '', 97 'url' => '',
98 'content_type' => '', 98 'content_type' => '',
99 'language' => '', 99 'language' => '',
100 'status' => '',
100 'open_graph' => [ 101 'open_graph' => [
101 'og_title' => 'my title', 102 'og_title' => 'my title',
102 'og_description' => 'desc', 103 'og_description' => 'desc',
@@ -111,6 +112,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
111 $this->assertEquals('<p>Unable to retrieve readable content.</p><p><i>But we found a short description: </i></p>desc', $entry->getContent()); 112 $this->assertEquals('<p>Unable to retrieve readable content.</p><p><i>But we found a short description: </i></p>desc', $entry->getContent());
112 $this->assertEmpty($entry->getPreviewPicture()); 113 $this->assertEmpty($entry->getPreviewPicture());
113 $this->assertEmpty($entry->getLanguage()); 114 $this->assertEmpty($entry->getLanguage());
115 $this->assertEmpty($entry->getHttpStatus());
114 $this->assertEmpty($entry->getMimetype()); 116 $this->assertEmpty($entry->getMimetype());
115 $this->assertEquals(0.0, $entry->getReadingTime()); 117 $this->assertEquals(0.0, $entry->getReadingTime());
116 $this->assertEquals('domain.io', $entry->getDomainName()); 118 $this->assertEquals('domain.io', $entry->getDomainName());
@@ -135,6 +137,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
135 'url' => 'http://1.1.1.1', 137 'url' => 'http://1.1.1.1',
136 'content_type' => 'text/html', 138 'content_type' => 'text/html',
137 'language' => 'fr', 139 'language' => 'fr',
140 'status' => '200',
138 'open_graph' => [ 141 'open_graph' => [
139 'og_title' => 'my OG title', 142 'og_title' => 'my OG title',
140 'og_description' => 'OG desc', 143 'og_description' => 'OG desc',
@@ -151,6 +154,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
151 $this->assertEquals('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture()); 154 $this->assertEquals('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture());
152 $this->assertEquals('text/html', $entry->getMimetype()); 155 $this->assertEquals('text/html', $entry->getMimetype());
153 $this->assertEquals('fr', $entry->getLanguage()); 156 $this->assertEquals('fr', $entry->getLanguage());
157 $this->assertEquals('200', $entry->getHttpStatus());
154 $this->assertEquals(4.0, $entry->getReadingTime()); 158 $this->assertEquals(4.0, $entry->getReadingTime());
155 $this->assertEquals('1.1.1.1', $entry->getDomainName()); 159 $this->assertEquals('1.1.1.1', $entry->getDomainName());
156 } 160 }