aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2017-11-21 10:37:36 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2017-11-21 10:37:36 +0100
commit709e21a3f4ef3616112a02be06045a1e3ab63a01 (patch)
tree7475cedd2d4af33256158646751d1783d7e2435b
parent8a21985474c2daae9f84ac52463fe7d297aae3ae (diff)
downloadwallabag-709e21a3f4ef3616112a02be06045a1e3ab63a01.tar.gz
wallabag-709e21a3f4ef3616112a02be06045a1e3ab63a01.tar.zst
wallabag-709e21a3f4ef3616112a02be06045a1e3ab63a01.zip
Define storeArticleHeaders false by default
Fix tests which must use `$storeArticleHeaders`. Fix CS
-rw-r--r--src/Wallabag/CoreBundle/Helper/ContentProxy.php2
-rw-r--r--tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php2
-rw-r--r--tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php2
-rw-r--r--tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php29
4 files changed, 18 insertions, 17 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php
index 3f5e4760..4cc20c9c 100644
--- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php
+++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php
@@ -26,7 +26,7 @@ class ContentProxy
26 protected $eventDispatcher; 26 protected $eventDispatcher;
27 protected $storeArticleHeaders; 27 protected $storeArticleHeaders;
28 28
29 public function __construct(Graby $graby, RuleBasedTagger $tagger, ValidatorInterface $validator, LoggerInterface $logger, $fetchingErrorMessage, $storeArticleHeaders) 29 public function __construct(Graby $graby, RuleBasedTagger $tagger, ValidatorInterface $validator, LoggerInterface $logger, $fetchingErrorMessage, $storeArticleHeaders = false)
30 { 30 {
31 $this->graby = $graby; 31 $this->graby = $graby;
32 $this->tagger = $tagger; 32 $this->tagger = $tagger;
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
index 95c64501..8a65f512 100644
--- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
@@ -855,7 +855,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
855 855
856 $content = json_decode($this->client->getResponse()->getContent(), true); 856 $content = json_decode($this->client->getResponse()->getContent(), true);
857 857
858 $this->assertSame(false, $content['exists']); 858 $this->assertFalse($content['exists']);
859 } 859 }
860 860
861 public function testGetEntriesExistsWithNoUrl() 861 public function testGetEntriesExistsWithNoUrl()
diff --git a/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php b/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php
index 5d6a29fe..5aee9f5c 100644
--- a/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php
+++ b/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php
@@ -68,7 +68,7 @@ class GrabySiteConfigBuilderTest extends \PHPUnit_Framework_TestCase
68 $config = $this->builder->buildForHost('www.example.com'); 68 $config = $this->builder->buildForHost('www.example.com');
69 69
70 $this->assertSame('example.com', $config->getHost()); 70 $this->assertSame('example.com', $config->getHost());
71 $this->assertSame(true, $config->requiresLogin()); 71 $this->assertTrue($config->requiresLogin());
72 $this->assertSame('http://www.example.com/login', $config->getLoginUri()); 72 $this->assertSame('http://www.example.com/login', $config->getLoginUri());
73 $this->assertSame('login', $config->getUsernameField()); 73 $this->assertSame('login', $config->getUsernameField());
74 $this->assertSame('password', $config->getPasswordField()); 74 $this->assertSame('password', $config->getPasswordField());
diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
index 2aac8c07..5c99e461 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
40 'language' => '', 40 'language' => '',
41 ]); 41 ]);
42 42
43 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, false); 43 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
44 $entry = new Entry(new User()); 44 $entry = new Entry(new User());
45 $proxy->updateEntry($entry, 'http://user@:80'); 45 $proxy->updateEntry($entry, 'http://user@:80');
46 46
@@ -51,7 +51,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
51 $this->assertEmpty($entry->getMimetype()); 51 $this->assertEmpty($entry->getMimetype());
52 $this->assertEmpty($entry->getLanguage()); 52 $this->assertEmpty($entry->getLanguage());
53 $this->assertSame(0.0, $entry->getReadingTime()); 53 $this->assertSame(0.0, $entry->getReadingTime());
54 $this->assertSame(null, $entry->getDomainName()); 54 $this->assertNull($entry->getDomainName());
55 } 55 }
56 56
57 public function testWithEmptyContent() 57 public function testWithEmptyContent()
@@ -75,7 +75,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
75 'language' => '', 75 'language' => '',
76 ]); 76 ]);
77 77
78 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, false); 78 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
79 $entry = new Entry(new User()); 79 $entry = new Entry(new User());
80 $proxy->updateEntry($entry, 'http://0.0.0.0'); 80 $proxy->updateEntry($entry, 'http://0.0.0.0');
81 81
@@ -115,7 +115,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
115 ], 115 ],
116 ]); 116 ]);
117 117
118 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, false); 118 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
119 $entry = new Entry(new User()); 119 $entry = new Entry(new User());
120 $proxy->updateEntry($entry, 'http://domain.io'); 120 $proxy->updateEntry($entry, 'http://domain.io');
121 121
@@ -157,7 +157,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
157 ], 157 ],
158 ]); 158 ]);
159 159
160 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, false); 160 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
161 $entry = new Entry(new User()); 161 $entry = new Entry(new User());
162 $proxy->updateEntry($entry, 'http://0.0.0.0'); 162 $proxy->updateEntry($entry, 'http://0.0.0.0');
163 163
@@ -199,7 +199,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
199 ], 199 ],
200 ]); 200 ]);
201 201
202 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, false); 202 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
203 $entry = new Entry(new User()); 203 $entry = new Entry(new User());
204 $proxy->updateEntry($entry, 'http://0.0.0.0'); 204 $proxy->updateEntry($entry, 'http://0.0.0.0');
205 205
@@ -241,7 +241,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
241 'status' => '200', 241 'status' => '200',
242 ]); 242 ]);
243 243
244 $proxy = new ContentProxy($graby, $tagger, $validator, $this->getLogger(), $this->fetchingErrorMessage, false); 244 $proxy = new ContentProxy($graby, $tagger, $validator, $this->getLogger(), $this->fetchingErrorMessage);
245 $entry = new Entry(new User()); 245 $entry = new Entry(new User());
246 $proxy->updateEntry($entry, 'http://0.0.0.0'); 246 $proxy->updateEntry($entry, 'http://0.0.0.0');
247 247
@@ -290,7 +290,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
290 ], 290 ],
291 ]); 291 ]);
292 292
293 $proxy = new ContentProxy($graby, $tagger, $validator, $this->getLogger(), $this->fetchingErrorMessage, false); 293 $proxy = new ContentProxy($graby, $tagger, $validator, $this->getLogger(), $this->fetchingErrorMessage);
294 $entry = new Entry(new User()); 294 $entry = new Entry(new User());
295 $proxy->updateEntry($entry, 'http://0.0.0.0'); 295 $proxy->updateEntry($entry, 'http://0.0.0.0');
296 296
@@ -311,7 +311,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
311 $tagger->expects($this->once()) 311 $tagger->expects($this->once())
312 ->method('tag'); 312 ->method('tag');
313 313
314 $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, false); 314 $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, true);
315 $entry = new Entry(new User()); 315 $entry = new Entry(new User());
316 $proxy->updateEntry( 316 $proxy->updateEntry(
317 $entry, 317 $entry,
@@ -341,6 +341,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
341 $this->assertContains('Jeremy', $entry->getPublishedBy()); 341 $this->assertContains('Jeremy', $entry->getPublishedBy());
342 $this->assertContains('Nico', $entry->getPublishedBy()); 342 $this->assertContains('Nico', $entry->getPublishedBy());
343 $this->assertContains('Thomas', $entry->getPublishedBy()); 343 $this->assertContains('Thomas', $entry->getPublishedBy());
344 $this->assertNotNull($entry->getHeaders(), 'Headers are stored, so value is not null');
344 $this->assertContains('no-cache', $entry->getHeaders()); 345 $this->assertContains('no-cache', $entry->getHeaders());
345 } 346 }
346 347
@@ -353,7 +354,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
353 $logHandler = new TestHandler(); 354 $logHandler = new TestHandler();
354 $logger = new Logger('test', [$logHandler]); 355 $logger = new Logger('test', [$logHandler]);
355 356
356 $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $logger, $this->fetchingErrorMessage, false); 357 $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $logger, $this->fetchingErrorMessage);
357 $entry = new Entry(new User()); 358 $entry = new Entry(new User());
358 $proxy->updateEntry( 359 $proxy->updateEntry(
359 $entry, 360 $entry,
@@ -388,7 +389,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
388 $handler = new TestHandler(); 389 $handler = new TestHandler();
389 $logger->pushHandler($handler); 390 $logger->pushHandler($handler);
390 391
391 $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $logger, $this->fetchingErrorMessage, false); 392 $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $logger, $this->fetchingErrorMessage);
392 $entry = new Entry(new User()); 393 $entry = new Entry(new User());
393 $proxy->updateEntry( 394 $proxy->updateEntry(
394 $entry, 395 $entry,
@@ -425,7 +426,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
425 ->method('tag') 426 ->method('tag')
426 ->will($this->throwException(new \Exception())); 427 ->will($this->throwException(new \Exception()));
427 428
428 $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, false); 429 $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
429 $entry = new Entry(new User()); 430 $entry = new Entry(new User());
430 $proxy->updateEntry( 431 $proxy->updateEntry(
431 $entry, 432 $entry,
@@ -465,7 +466,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
465 $tagger->expects($this->once()) 466 $tagger->expects($this->once())
466 ->method('tag'); 467 ->method('tag');
467 468
468 $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, false); 469 $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
469 $entry = new Entry(new User()); 470 $entry = new Entry(new User());
470 $proxy->updateEntry( 471 $proxy->updateEntry(
471 $entry, 472 $entry,
@@ -517,7 +518,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
517 'open_graph' => [], 518 'open_graph' => [],
518 ]); 519 ]);
519 520
520 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, false); 521 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
521 $entry = new Entry(new User()); 522 $entry = new Entry(new User());
522 $proxy->updateEntry($entry, 'http://0.0.0.0'); 523 $proxy->updateEntry($entry, 'http://0.0.0.0');
523 524