1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-08-01 17:38:38 +00:00

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`.
This commit is contained in:
Nicolas Lœuillet 2017-07-10 21:32:25 +02:00 committed by Jeremy Benoist
parent e9579d6de9
commit b7fa51ae7d
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
6 changed files with 158 additions and 2 deletions

View file

@ -166,7 +166,6 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertSame($this->url, $content->getUrl());
$this->assertContains('Google', $content->getTitle());
$this->assertSame('fr', $content->getLanguage());
$this->assertSame('2015-03-28 11:43:19', $content->getPublishedAt()->format('Y-m-d H:i:s'));
$this->assertArrayHasKey('x-frame-options', $content->getHeaders());
$client->getContainer()->get('craue_config')->set('store_article_headers', 0);
}
@ -266,6 +265,41 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertContains('/view/', $client->getResponse()->getTargetUrl());
}
public function testPostNewOkUrlExistWithRedirection()
{
$this->logInAs('admin');
$client = $this->getClient();
$url = 'https://wllbg.org/test-redirect/c51c';
$crawler = $client->request('GET', '/new');
$this->assertSame(200, $client->getResponse()->getStatusCode());
$form = $crawler->filter('form[name=entry]')->form();
$data = [
'entry[url]' => $url,
];
$client->submit($form, $data);
$crawler = $client->request('GET', '/new');
$this->assertSame(200, $client->getResponse()->getStatusCode());
$form = $crawler->filter('form[name=entry]')->form();
$data = [
'entry[url]' => $url,
];
$client->submit($form, $data);
$this->assertSame(302, $client->getResponse()->getStatusCode());
$this->assertContains('/view/', $client->getResponse()->getTargetUrl());
}
/**
* This test will require an internet connection.
*/