]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php
Fix `findOneByUrl` side effect in tests
[github/wallabag/wallabag.git] / src / Wallabag / ImportBundle / Tests / Import / PocketImportTest.php
index 6ee70db047b0b7f61607f61a5ab3b76906fc24b7..76225fe4f21be2b119f7b17b9c247a7e5f3d1dc4 100644 (file)
@@ -75,7 +75,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
 
         $this->assertEquals('Pocket', $pocketImport->getName());
         $this->assertNotEmpty($pocketImport->getUrl());
-        $this->assertContains('This importer will import all your <a href="https://getpocket.com">Pocket</a> data.', $pocketImport->getDescription());
+        $this->assertContains('This importer will import all your Pocket data.', $pocketImport->getDescription());
     }
 
     public function testOAuthRequest()
@@ -248,7 +248,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
             ->getMock();
 
         $entryRepo->expects($this->exactly(2))
-            ->method('existByUrlAndUserId')
+            ->method('findByUrlAndUserId')
             ->will($this->onConsecutiveCalls(false, true));
 
         $tag = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Tag')
@@ -260,7 +260,9 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
             ->getMock();
 
         $tagRepo->expects($this->exactly(2))
-            ->method('findOneByLabelAndUserId')
+            // the method `findOneByLabel` doesn't exist, EntityRepository will then call `_call` method
+            // to magically call the `findOneBy` with ['label' => 'foo']
+            ->method('__call')
             ->will($this->onConsecutiveCalls(false, $tag));
 
         $this->em