From 8a21985474c2daae9f84ac52463fe7d297aae3ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 20 Nov 2017 17:39:14 +0100 Subject: Added internal setting to enable/disable headers storage --- .../CoreBundle/Controller/EntryControllerTest.php | 3 +++ .../CoreBundle/Helper/ContentProxyTest.php | 26 +++++++++++----------- 2 files changed, 16 insertions(+), 13 deletions(-) (limited to 'tests/Wallabag') diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 6e806553..2a2fd1a4 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php @@ -137,6 +137,8 @@ class EntryControllerTest extends WallabagCoreTestCase $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 @@ class EntryControllerTest extends WallabagCoreTestCase $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() diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php index f94c2137..2aac8c07 100644 --- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php +++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php @@ -40,7 +40,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase 'language' => '', ]); - $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage); + $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, false); $entry = new Entry(new User()); $proxy->updateEntry($entry, 'http://user@:80'); @@ -75,7 +75,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase 'language' => '', ]); - $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage); + $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, false); $entry = new Entry(new User()); $proxy->updateEntry($entry, 'http://0.0.0.0'); @@ -115,7 +115,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ], ]); - $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage); + $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, false); $entry = new Entry(new User()); $proxy->updateEntry($entry, 'http://domain.io'); @@ -157,7 +157,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ], ]); - $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage); + $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, false); $entry = new Entry(new User()); $proxy->updateEntry($entry, 'http://0.0.0.0'); @@ -199,7 +199,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ], ]); - $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage); + $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, false); $entry = new Entry(new User()); $proxy->updateEntry($entry, 'http://0.0.0.0'); @@ -241,7 +241,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase 'status' => '200', ]); - $proxy = new ContentProxy($graby, $tagger, $validator, $this->getLogger(), $this->fetchingErrorMessage); + $proxy = new ContentProxy($graby, $tagger, $validator, $this->getLogger(), $this->fetchingErrorMessage, false); $entry = new Entry(new User()); $proxy->updateEntry($entry, 'http://0.0.0.0'); @@ -290,7 +290,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ], ]); - $proxy = new ContentProxy($graby, $tagger, $validator, $this->getLogger(), $this->fetchingErrorMessage); + $proxy = new ContentProxy($graby, $tagger, $validator, $this->getLogger(), $this->fetchingErrorMessage, false); $entry = new Entry(new User()); $proxy->updateEntry($entry, 'http://0.0.0.0'); @@ -311,7 +311,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase $tagger->expects($this->once()) ->method('tag'); - $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage); + $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, false); $entry = new Entry(new User()); $proxy->updateEntry( $entry, @@ -353,7 +353,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase $logHandler = new TestHandler(); $logger = new Logger('test', [$logHandler]); - $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $logger, $this->fetchingErrorMessage); + $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $logger, $this->fetchingErrorMessage, false); $entry = new Entry(new User()); $proxy->updateEntry( $entry, @@ -388,7 +388,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase $handler = new TestHandler(); $logger->pushHandler($handler); - $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $logger, $this->fetchingErrorMessage); + $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $logger, $this->fetchingErrorMessage, false); $entry = new Entry(new User()); $proxy->updateEntry( $entry, @@ -425,7 +425,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ->method('tag') ->will($this->throwException(new \Exception())); - $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage); + $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, false); $entry = new Entry(new User()); $proxy->updateEntry( $entry, @@ -465,7 +465,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase $tagger->expects($this->once()) ->method('tag'); - $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage); + $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, false); $entry = new Entry(new User()); $proxy->updateEntry( $entry, @@ -517,7 +517,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase 'open_graph' => [], ]); - $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage); + $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, false); $entry = new Entry(new User()); $proxy->updateEntry($entry, 'http://0.0.0.0'); -- cgit v1.2.3