]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php
reimport v1 entries if they were not fetched
[github/wallabag/wallabag.git] / src / Wallabag / ImportBundle / Tests / Import / WallabagV1ImportTest.php
index d5b41777caf041f0f6b46b5571bf2f2eb21fd1e9..78cc19b6bcbc7fc542617448050277fdee7a839f 100644 (file)
@@ -12,6 +12,8 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
     protected $user;
     protected $em;
     protected $logHandler;
+    protected $contentProxy;
+
 
     private function getWallabagV1Import($unsetUser = false)
     {
@@ -21,17 +23,21 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
             ->disableOriginalConstructor()
             ->getMock();
 
-        $pocket = new WallabagV1Import($this->em);
+        $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $wallabag = new WallabagV1Import($this->em,$this->contentProxy);
 
         $this->logHandler = new TestHandler();
         $logger = new Logger('test', array($this->logHandler));
-        $pocket->setLogger($logger);
+        $wallabag->setLogger($logger);
 
         if (false === $unsetUser) {
-            $pocket->setUser($this->user);
+            $wallabag->setUser($this->user);
         }
 
-        return $pocket;
+        return $wallabag;
     }
 
     public function testInit()
@@ -53,7 +59,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
             ->getMock();
 
         $entryRepo->expects($this->exactly(3))
-            ->method('existByUrlAndUserId')
+            ->method('findByUrlAndUserId')
             ->will($this->onConsecutiveCalls(false, true, false));
 
         $this->em
@@ -77,7 +83,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
         $this->assertFalse($res);
 
         $records = $this->logHandler->getRecords();
-        $this->assertContains('WallabagV1Import: unable to read file', $records[0]['message']);
+        $this->assertContains('WallabagImport: unable to read file', $records[0]['message']);
         $this->assertEquals('ERROR', $records[0]['level_name']);
     }
 
@@ -91,7 +97,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
         $this->assertFalse($res);
 
         $records = $this->logHandler->getRecords();
-        $this->assertContains('WallabagV1Import: user is not defined', $records[0]['message']);
+        $this->assertContains('WallabagImport: user is not defined', $records[0]['message']);
         $this->assertEquals('ERROR', $records[0]['level_name']);
     }
 }