diff options
author | Jeremy Benoist <jbenoist@20minutes.fr> | 2017-06-01 11:31:45 +0200 |
---|---|---|
committer | Jeremy Benoist <jbenoist@20minutes.fr> | 2017-06-01 11:31:45 +0200 |
commit | 6acadf8e98cf6021a9019773df75bdb151865687 (patch) | |
tree | c517962bd405fff9863a7fc7ed5b7d821f68f90f /tests/Wallabag/CoreBundle/Helper | |
parent | 843182c7cf428b5f6b8a1ff7057adc703c1e816e (diff) | |
download | wallabag-6acadf8e98cf6021a9019773df75bdb151865687.tar.gz wallabag-6acadf8e98cf6021a9019773df75bdb151865687.tar.zst wallabag-6acadf8e98cf6021a9019773df75bdb151865687.zip |
Rewrote code & fix tests
Diffstat (limited to 'tests/Wallabag/CoreBundle/Helper')
-rw-r--r-- | tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php index be287d84..a3570125 100644 --- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php +++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php | |||
@@ -11,8 +11,6 @@ use Wallabag\CoreBundle\Entity\Tag; | |||
11 | use Wallabag\UserBundle\Entity\User; | 11 | use Wallabag\UserBundle\Entity\User; |
12 | use Wallabag\CoreBundle\Helper\RuleBasedTagger; | 12 | use Wallabag\CoreBundle\Helper\RuleBasedTagger; |
13 | use Graby\Graby; | 13 | use Graby\Graby; |
14 | use Monolog\Handler\TestHandler; | ||
15 | use Monolog\Logger; | ||
16 | 14 | ||
17 | class ContentProxyTest extends \PHPUnit_Framework_TestCase | 15 | class ContentProxyTest extends \PHPUnit_Framework_TestCase |
18 | { | 16 | { |
@@ -259,12 +257,13 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
259 | ->method('tag'); | 257 | ->method('tag'); |
260 | 258 | ||
261 | $logHandler = new TestHandler(); | 259 | $logHandler = new TestHandler(); |
262 | $logger = new Logger('test', array($logHandler)); | 260 | $logger = new Logger('test', [$logHandler]); |
263 | 261 | ||
264 | $proxy = new ContentProxy((new Graby()), $tagger, $logger, $this->fetchingErrorMessage); | 262 | $proxy = new ContentProxy((new Graby()), $tagger, $logger, $this->fetchingErrorMessage); |
265 | $entry = new Entry(new User()); | 263 | $entry = new Entry(new User()); |
266 | $proxy->importEntry( | 264 | $proxy->updateEntry( |
267 | $entry, | 265 | $entry, |
266 | 'http://1.1.1.1', | ||
268 | [ | 267 | [ |
269 | 'html' => str_repeat('this is my content', 325), | 268 | 'html' => str_repeat('this is my content', 325), |
270 | 'title' => 'this is my title', | 269 | 'title' => 'this is my title', |
@@ -299,6 +298,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
299 | $entry = new Entry(new User()); | 298 | $entry = new Entry(new User()); |
300 | $proxy->updateEntry( | 299 | $proxy->updateEntry( |
301 | $entry, | 300 | $entry, |
301 | 'http://1.1.1.1', | ||
302 | [ | 302 | [ |
303 | 'html' => str_repeat('this is my content', 325), | 303 | 'html' => str_repeat('this is my content', 325), |
304 | 'title' => 'this is my title', | 304 | 'title' => 'this is my title', |
@@ -326,26 +326,24 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
326 | 326 | ||
327 | public function testTaggerThrowException() | 327 | public function testTaggerThrowException() |
328 | { | 328 | { |
329 | $graby = $this->getMockBuilder('Graby\Graby') | ||
330 | ->disableOriginalConstructor() | ||
331 | ->getMock(); | ||
332 | |||
333 | $tagger = $this->getTaggerMock(); | 329 | $tagger = $this->getTaggerMock(); |
334 | $tagger->expects($this->once()) | 330 | $tagger->expects($this->once()) |
335 | ->method('tag') | 331 | ->method('tag') |
336 | ->will($this->throwException(new \Exception())); | 332 | ->will($this->throwException(new \Exception())); |
337 | 333 | ||
338 | $proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage); | 334 | $proxy = new ContentProxy((new Graby()), $tagger, $this->getLogger(), $this->fetchingErrorMessage); |
339 | |||
340 | $entry = new Entry(new User()); | 335 | $entry = new Entry(new User()); |
341 | $content = array( | 336 | $proxy->updateEntry( |
342 | 'html' => str_repeat('this is my content', 325), | 337 | $entry, |
343 | 'title' => 'this is my title', | 338 | 'http://1.1.1.1', |
344 | 'url' => 'http://1.1.1.1', | 339 | [ |
345 | 'content_type' => 'text/html', | 340 | 'html' => str_repeat('this is my content', 325), |
346 | 'language' => 'fr', | 341 | 'title' => 'this is my title', |
342 | 'url' => 'http://1.1.1.1', | ||
343 | 'content_type' => 'text/html', | ||
344 | 'language' => 'fr', | ||
345 | ] | ||
347 | ); | 346 | ); |
348 | $proxy->importEntry($entry, $content, true); | ||
349 | 347 | ||
350 | $this->assertCount(0, $entry->getTags()); | 348 | $this->assertCount(0, $entry->getTags()); |
351 | } | 349 | } |
@@ -374,8 +372,9 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
374 | ->method('tag'); | 372 | ->method('tag'); |
375 | 373 | ||
376 | $proxy = new ContentProxy((new Graby()), $tagger, $this->getLogger(), $this->fetchingErrorMessage); | 374 | $proxy = new ContentProxy((new Graby()), $tagger, $this->getLogger(), $this->fetchingErrorMessage); |
377 | $entry = $proxy->updateEntry( | 375 | $entry = new Entry(new User()); |
378 | new Entry(new User()), | 376 | $proxy->updateEntry( |
377 | $entry, | ||
379 | 'http://1.1.1.1', | 378 | 'http://1.1.1.1', |
380 | [ | 379 | [ |
381 | 'html' => $html, | 380 | 'html' => $html, |