diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-10-02 13:14:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-02 13:14:16 +0200 |
commit | 92395680b6ac76a2776f3635803b5de447014b11 (patch) | |
tree | 03246535a5f4ca9c1fdbdea4e4748ae19fbeb338 /tests/Wallabag/CoreBundle | |
parent | 52c1fc7449554c942c945e6c740e0e11d2f60a0d (diff) | |
parent | d6d3fb6e4c92ec8d71b3f8c6d91e0f8ab80f795b (diff) | |
download | wallabag-92395680b6ac76a2776f3635803b5de447014b11.tar.gz wallabag-92395680b6ac76a2776f3635803b5de447014b11.tar.zst wallabag-92395680b6ac76a2776f3635803b5de447014b11.zip |
Merge pull request #2328 from wallabag/avoid-duplicate-url
Avoid duplicate url with accents
Diffstat (limited to 'tests/Wallabag/CoreBundle')
-rw-r--r-- | tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 053aa679..c40e10a5 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | |||
@@ -160,6 +160,50 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
160 | $this->assertContains('/view/', $client->getResponse()->getTargetUrl()); | 160 | $this->assertContains('/view/', $client->getResponse()->getTargetUrl()); |
161 | } | 161 | } |
162 | 162 | ||
163 | public function testPostNewOkUrlExistWithAccent() | ||
164 | { | ||
165 | $this->logInAs('admin'); | ||
166 | $client = $this->getClient(); | ||
167 | |||
168 | $url = 'http://www.aritylabs.com/post/106091708292/des-contr%C3%B4leurs-optionnels-gr%C3%A2ce-%C3%A0-constmissing'; | ||
169 | |||
170 | $crawler = $client->request('GET', '/new'); | ||
171 | |||
172 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
173 | |||
174 | $form = $crawler->filter('form[name=entry]')->form(); | ||
175 | |||
176 | $data = [ | ||
177 | 'entry[url]' => $url, | ||
178 | ]; | ||
179 | |||
180 | $client->submit($form, $data); | ||
181 | |||
182 | $crawler = $client->request('GET', '/new'); | ||
183 | |||
184 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
185 | |||
186 | $form = $crawler->filter('form[name=entry]')->form(); | ||
187 | |||
188 | $data = [ | ||
189 | 'entry[url]' => $url, | ||
190 | ]; | ||
191 | |||
192 | $client->submit($form, $data); | ||
193 | |||
194 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
195 | $this->assertContains('/view/', $client->getResponse()->getTargetUrl()); | ||
196 | |||
197 | $em = $client->getContainer() | ||
198 | ->get('doctrine.orm.entity_manager'); | ||
199 | $entry = $em | ||
200 | ->getRepository('WallabagCoreBundle:Entry') | ||
201 | ->findOneByUrl(urldecode($url)); | ||
202 | |||
203 | $em->remove($entry); | ||
204 | $em->flush(); | ||
205 | } | ||
206 | |||
163 | /** | 207 | /** |
164 | * This test will require an internet connection. | 208 | * This test will require an internet connection. |
165 | */ | 209 | */ |