diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php index 1d1620dc..32d6a575 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php | |||
@@ -127,10 +127,35 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
127 | 127 | ||
128 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 128 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
129 | 129 | ||
130 | $crawler = $client->followRedirect(); | 130 | $content = $client->getContainer() |
131 | ->get('doctrine.orm.entity_manager') | ||
132 | ->getRepository('WallabagCoreBundle:Entry') | ||
133 | ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); | ||
134 | |||
135 | $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); | ||
136 | $this->assertEquals($this->url, $content->getUrl()); | ||
137 | $this->assertContains('Google', $content->getTitle()); | ||
138 | } | ||
139 | |||
140 | public function testPostNewOkUrlExist() | ||
141 | { | ||
142 | $this->logInAs('admin'); | ||
143 | $client = $this->getClient(); | ||
144 | |||
145 | $crawler = $client->request('GET', '/new'); | ||
146 | |||
147 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
148 | |||
149 | $form = $crawler->filter('button[type=submit]')->form(); | ||
150 | |||
151 | $data = array( | ||
152 | 'entry[url]' => $this->url, | ||
153 | ); | ||
131 | 154 | ||
132 | $this->assertGreaterThan(1, $alert = $crawler->filter('h2 a')->extract(array('_text'))); | 155 | $client->submit($form, $data); |
133 | $this->assertContains('Google', $alert[0]); | 156 | |
157 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
158 | $this->assertContains('/view/', $client->getResponse()->getTargetUrl()); | ||
134 | } | 159 | } |
135 | 160 | ||
136 | /** | 161 | /** |