]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php
Rewrote code & fix tests
[github/wallabag/wallabag.git] / tests / Wallabag / ImportBundle / Import / WallabagV1ImportTest.php
index f23cb74894f0c08d39ec9da96ab5176c9c00ebb9..834b7ef57bcbc1609ea9f97c3292a17c72e735c3 100644 (file)
@@ -19,6 +19,8 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
     protected $contentProxy;
     protected $tagsAssigner;
     protected $uow;
+    protected $fetchingErrorMessageTitle = 'No title found';
+    protected $fetchingErrorMessage = 'wallabag can\'t retrieve contents for this article. Please <a href="http://doc.wallabag.org/en/master/user/errors_during_fetching.html#how-can-i-help-to-fix-that">troubleshoot this issue</a>.';
 
     private function getWallabagV1Import($unsetUser = false, $dispatched = 0)
     {
@@ -58,7 +60,14 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
             ->expects($this->exactly($dispatched))
             ->method('dispatch');
 
-        $wallabag = new WallabagV1Import($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
+        $wallabag = new WallabagV1Import(
+            $this->em,
+            $this->contentProxy,
+            $this->tagsAssigner,
+            $dispatcher,
+            $this->fetchingErrorMessageTitle,
+            $this->fetchingErrorMessage
+        );
 
         $this->logHandler = new TestHandler();
         $logger = new Logger('test', [$this->logHandler]);
@@ -104,7 +113,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
 
         $this->contentProxy
             ->expects($this->exactly(1))
-            ->method('importEntry')
+            ->method('updateEntry')
             ->willReturn($entry);
 
         $res = $wallabagV1Import->import();
@@ -133,7 +142,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
 
         $this->contentProxy
             ->expects($this->exactly(3))
-            ->method('importEntry')
+            ->method('updateEntry')
             ->willReturn(new Entry($this->user));
 
         // check that every entry persisted are archived
@@ -173,7 +182,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
 
         $this->contentProxy
             ->expects($this->never())
-            ->method('importEntry');
+            ->method('updateEntry');
 
         $producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
             ->disableOriginalConstructor()
@@ -213,7 +222,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
 
         $this->contentProxy
             ->expects($this->never())
-            ->method('importEntry');
+            ->method('updateEntry');
 
         $factory = new RedisMockFactory();
         $redisMock = $factory->getAdapter('Predis\Client', true);