aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2017-07-10 21:32:25 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2019-05-29 13:50:59 +0200
commitb7fa51ae7dd5fef2d9459100c88479413ddd3fb3 (patch)
tree0395f1ada65ba54578ab13b8c2398592b65bd6a1 /tests
parente9579d6de9ea99522e5905e8bb827e858c8da1fc (diff)
downloadwallabag-b7fa51ae7dd5fef2d9459100c88479413ddd3fb3.tar.gz
wallabag-b7fa51ae7dd5fef2d9459100c88479413ddd3fb3.tar.zst
wallabag-b7fa51ae7dd5fef2d9459100c88479413ddd3fb3.zip
Added given_url in entry table
- Added index on entry table for given_url field - Fix tests: The previous `bit.ly` url redirected to doc.wallabag but that url doesn't exist in the fixtures. I used our own internal "redirector" to create a redirect to an url which exist in the fixtures. Also, updating current migration to use the new `WallabagMigration`.
Diffstat (limited to 'tests')
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php36
1 files changed, 35 insertions, 1 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
index 9dee9891..a6fd3fff 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 }
@@ -266,6 +265,41 @@ class EntryControllerTest extends WallabagCoreTestCase
266 $this->assertContains('/view/', $client->getResponse()->getTargetUrl()); 265 $this->assertContains('/view/', $client->getResponse()->getTargetUrl());
267 } 266 }
268 267
268 public function testPostNewOkUrlExistWithRedirection()
269 {
270 $this->logInAs('admin');
271 $client = $this->getClient();
272
273 $url = 'https://wllbg.org/test-redirect/c51c';
274
275 $crawler = $client->request('GET', '/new');
276
277 $this->assertSame(200, $client->getResponse()->getStatusCode());
278
279 $form = $crawler->filter('form[name=entry]')->form();
280
281 $data = [
282 'entry[url]' => $url,
283 ];
284
285 $client->submit($form, $data);
286
287 $crawler = $client->request('GET', '/new');
288
289 $this->assertSame(200, $client->getResponse()->getStatusCode());
290
291 $form = $crawler->filter('form[name=entry]')->form();
292
293 $data = [
294 'entry[url]' => $url,
295 ];
296
297 $client->submit($form, $data);
298
299 $this->assertSame(302, $client->getResponse()->getStatusCode());
300 $this->assertContains('/view/', $client->getResponse()->getTargetUrl());
301 }
302
269 /** 303 /**
270 * This test will require an internet connection. 304 * This test will require an internet connection.
271 */ 305 */