From: Nicolas LÅ“uillet Date: Tue, 21 Nov 2017 12:26:24 +0000 (+0100) Subject: Merge pull request #3425 from wallabag/add-setting-for-headers X-Git-Tag: 2.3.0~17 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=95b7d92ea5f92078c2e1fed0b346a9722de762c4;hp=-c;p=github%2Fwallabag%2Fwallabag.git Merge pull request #3425 from wallabag/add-setting-for-headers Added internal setting to enable/disable headers storage --- 95b7d92ea5f92078c2e1fed0b346a9722de762c4 diff --combined tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index c6a523e3,2a2fd1a4..4ac4548b --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php @@@ -137,6 -137,8 +137,8 @@@ class EntryControllerTest extends Walla $this->logInAs('admin'); $client = $this->getClient(); + $client->getContainer()->get('craue_config')->set('store_article_headers', 1); + $crawler = $client->request('GET', '/new'); $this->assertSame(200, $client->getResponse()->getStatusCode()); @@@ -165,6 -167,7 +167,7 @@@ $this->assertSame('2015-03-28 11:43:19', $content->getPublishedAt()->format('Y-m-d H:i:s')); $this->assertSame('Morgane Tual', $author[0]); $this->assertArrayHasKey('x-varnish1', $content->getHeaders()); + $client->getContainer()->get('craue_config')->set('store_article_headers', 0); } public function testPostWithMultipleAuthors() @@@ -475,7 -478,6 +478,7 @@@ $data = [ 'entry[title]' => 'My updated title hehe :)', + 'entry[origin_url]' => 'https://example.io', ]; $client->submit($form, $data); @@@ -484,43 -486,8 +487,43 @@@ $crawler = $client->followRedirect(); - $this->assertGreaterThan(1, $alert = $crawler->filter('div[id=article] h1')->extract(['_text'])); - $this->assertContains('My updated title hehe :)', $alert[0]); + $this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text'])); + $this->assertContains('My updated title hehe :)', $title[0]); + $this->assertGreaterThan(1, $stats = $crawler->filter('div[class=tools] ul[class=stats] li a[class=tool]')->extract(['_text'])); + $this->assertContains('example.io', trim($stats[1])); + } + + public function testEditRemoveOriginUrl() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $entry = new Entry($this->getLoggedInUser()); + $entry->setUrl($this->url); + $this->getEntityManager()->persist($entry); + $this->getEntityManager()->flush(); + + $crawler = $client->request('GET', '/edit/' . $entry->getId()); + + $this->assertSame(200, $client->getResponse()->getStatusCode()); + + $form = $crawler->filter('button[type=submit]')->form(); + + $data = [ + 'entry[title]' => 'My updated title hehe :)', + 'entry[origin_url]' => '', + ]; + + $client->submit($form, $data); + + $this->assertSame(302, $client->getResponse()->getStatusCode()); + + $crawler = $client->followRedirect(); + + $this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text'])); + $this->assertContains('My updated title hehe :)', $title[0]); + $this->assertSame(1, count($stats = $crawler->filter('div[class=tools] ul[class=stats] li a[class=tool]')->extract(['_text']))); + $this->assertNotContains('example.io', trim($stats[0])); } public function testToggleArchive()