diff options
author | Jérémy Benoist <j0k3r@users.noreply.github.com> | 2019-06-05 11:38:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-05 11:38:00 +0200 |
commit | 16e1c07553d276f6a4df8fb0f2d1aa25026d73be (patch) | |
tree | 30771618e781968dbbc79fa7113db266017a35ae /tests | |
parent | 8671da5eadc93204f2742bb6b2b5b8fc1eddf131 (diff) | |
parent | d8809f70ea3a2f88635827b37af23b2fc2a93db6 (diff) | |
download | wallabag-16e1c07553d276f6a4df8fb0f2d1aa25026d73be.tar.gz wallabag-16e1c07553d276f6a4df8fb0f2d1aa25026d73be.tar.zst wallabag-16e1c07553d276f6a4df8fb0f2d1aa25026d73be.zip |
Merge pull request #3271 from wallabag/store-resolved-url
Add `given_url` in Entry table to check if a redirected url has already added
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 9dee9891..e9c12c49 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | |||
@@ -166,7 +166,6 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
166 | $this->assertSame($this->url, $content->getUrl()); | 166 | $this->assertSame($this->url, $content->getUrl()); |
167 | $this->assertContains('Google', $content->getTitle()); | 167 | $this->assertContains('Google', $content->getTitle()); |
168 | $this->assertSame('fr', $content->getLanguage()); | 168 | $this->assertSame('fr', $content->getLanguage()); |
169 | $this->assertSame('2015-03-28 11:43:19', $content->getPublishedAt()->format('Y-m-d H:i:s')); | ||
170 | $this->assertArrayHasKey('x-frame-options', $content->getHeaders()); | 169 | $this->assertArrayHasKey('x-frame-options', $content->getHeaders()); |
171 | $client->getContainer()->get('craue_config')->set('store_article_headers', 0); | 170 | $client->getContainer()->get('craue_config')->set('store_article_headers', 0); |
172 | } | 171 | } |
@@ -269,6 +268,44 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
269 | /** | 268 | /** |
270 | * This test will require an internet connection. | 269 | * This test will require an internet connection. |
271 | */ | 270 | */ |
271 | public function testPostNewOkUrlExistWithRedirection() | ||
272 | { | ||
273 | $this->logInAs('admin'); | ||
274 | $client = $this->getClient(); | ||
275 | |||
276 | $url = 'https://wllbg.org/test-redirect/c51c'; | ||
277 | |||
278 | $crawler = $client->request('GET', '/new'); | ||
279 | |||
280 | $this->assertSame(200, $client->getResponse()->getStatusCode()); | ||
281 | |||
282 | $form = $crawler->filter('form[name=entry]')->form(); | ||
283 | |||
284 | $data = [ | ||
285 | 'entry[url]' => $url, | ||
286 | ]; | ||
287 | |||
288 | $client->submit($form, $data); | ||
289 | |||
290 | $crawler = $client->request('GET', '/new'); | ||
291 | |||
292 | $this->assertSame(200, $client->getResponse()->getStatusCode()); | ||
293 | |||
294 | $form = $crawler->filter('form[name=entry]')->form(); | ||
295 | |||
296 | $data = [ | ||
297 | 'entry[url]' => $url, | ||
298 | ]; | ||
299 | |||
300 | $client->submit($form, $data); | ||
301 | |||
302 | $this->assertSame(302, $client->getResponse()->getStatusCode()); | ||
303 | $this->assertContains('/view/', $client->getResponse()->getTargetUrl()); | ||
304 | } | ||
305 | |||
306 | /** | ||
307 | * This test will require an internet connection. | ||
308 | */ | ||
272 | public function testPostNewThatWillBeTagged() | 309 | public function testPostNewThatWillBeTagged() |
273 | { | 310 | { |
274 | $this->logInAs('admin'); | 311 | $this->logInAs('admin'); |