diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php index 5512d6e1..46fbaf91 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php | |||
@@ -25,17 +25,18 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
25 | $client = $this->getClient(); | 25 | $client = $this->getClient(); |
26 | 26 | ||
27 | $client->request('GET', '/unread/list'); | 27 | $client->request('GET', '/unread/list'); |
28 | $client->followRedirect(); | 28 | $crawler = $client->followRedirect(); |
29 | 29 | ||
30 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 30 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
31 | $this->assertContains('We\'ll accompany you to visit wallabag', $client->getResponse()->getContent()); | 31 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); |
32 | $this->assertContains('quickstart.intro.paragraph_1', $body[0]); | ||
32 | 33 | ||
33 | // Test if quickstart is disabled when user has 1 entry | 34 | // Test if quickstart is disabled when user has 1 entry |
34 | $crawler = $client->request('GET', '/new'); | 35 | $crawler = $client->request('GET', '/new'); |
35 | 36 | ||
36 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 37 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
37 | 38 | ||
38 | $form = $crawler->filter('button[type=submit]')->form(); | 39 | $form = $crawler->filter('form[name=entry]')->form(); |
39 | 40 | ||
40 | $data = array( | 41 | $data = array( |
41 | 'entry[url]' => $this->url, | 42 | 'entry[url]' => $this->url, |
@@ -45,8 +46,9 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
45 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 46 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
46 | $client->followRedirect(); | 47 | $client->followRedirect(); |
47 | 48 | ||
48 | $client->request('GET', '/unread/list'); | 49 | $crawler = $client->request('GET', '/unread/list'); |
49 | $this->assertContains('There is one entry.', $client->getResponse()->getContent()); | 50 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); |
51 | $this->assertContains('entry.list.number_on_the_page', $body[0]); | ||
50 | } | 52 | } |
51 | 53 | ||
52 | public function testGetNew() | 54 | public function testGetNew() |
@@ -59,7 +61,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
59 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 61 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
60 | 62 | ||
61 | $this->assertCount(1, $crawler->filter('input[type=url]')); | 63 | $this->assertCount(1, $crawler->filter('input[type=url]')); |
62 | $this->assertCount(1, $crawler->filter('button[type=submit]')); | 64 | $this->assertCount(1, $crawler->filter('form[name=entry]')); |
63 | } | 65 | } |
64 | 66 | ||
65 | public function testPostNewViaBookmarklet() | 67 | public function testPostNewViaBookmarklet() |
@@ -96,7 +98,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
96 | 98 | ||
97 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 99 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
98 | 100 | ||
99 | $form = $crawler->filter('button[type=submit]')->form(); | 101 | $form = $crawler->filter('form[name=entry]')->form(); |
100 | 102 | ||
101 | $crawler = $client->submit($form); | 103 | $crawler = $client->submit($form); |
102 | 104 | ||
@@ -117,7 +119,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
117 | 119 | ||
118 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 120 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
119 | 121 | ||
120 | $form = $crawler->filter('button[type=submit]')->form(); | 122 | $form = $crawler->filter('form[name=entry]')->form(); |
121 | 123 | ||
122 | $data = array( | 124 | $data = array( |
123 | 'entry[url]' => $this->url, | 125 | 'entry[url]' => $this->url, |
@@ -146,7 +148,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
146 | 148 | ||
147 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 149 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
148 | 150 | ||
149 | $form = $crawler->filter('button[type=submit]')->form(); | 151 | $form = $crawler->filter('form[name=entry]')->form(); |
150 | 152 | ||
151 | $data = array( | 153 | $data = array( |
152 | 'entry[url]' => $this->url, | 154 | 'entry[url]' => $this->url, |
@@ -170,7 +172,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
170 | 172 | ||
171 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 173 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
172 | 174 | ||
173 | $form = $crawler->filter('button[type=submit]')->form(); | 175 | $form = $crawler->filter('form[name=entry]')->form(); |
174 | 176 | ||
175 | $data = array( | 177 | $data = array( |
176 | 'entry[url]' => $url = 'https://github.com/wallabag/wallabag', | 178 | 'entry[url]' => $url = 'https://github.com/wallabag/wallabag', |
@@ -240,10 +242,11 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
240 | ->getRepository('WallabagCoreBundle:Entry') | 242 | ->getRepository('WallabagCoreBundle:Entry') |
241 | ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); | 243 | ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); |
242 | 244 | ||
243 | $client->request('GET', '/view/'.$content->getId()); | 245 | $crawler = $client->request('GET', '/view/'.$content->getId()); |
244 | 246 | ||
245 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 247 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
246 | $this->assertContains($content->getTitle(), $client->getResponse()->getContent()); | 248 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); |
249 | $this->assertContains($content->getTitle(), $body[0]); | ||
247 | } | 250 | } |
248 | 251 | ||
249 | /** | 252 | /** |