]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Fix tag related test for Pocket
authorJeremy Benoist <jeremy.benoist@gmail.com>
Sun, 3 Jan 2016 09:32:56 +0000 (10:32 +0100)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Sun, 3 Jan 2016 09:32:56 +0000 (10:32 +0100)
src/Wallabag/ImportBundle/Import/PocketImport.php
src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php

index b1c5bb0013d825e8ca8ecfa4135eef4b17fba588..853ad135a2fff36e92c84c7f799af98c7d22ef51 100644 (file)
@@ -184,13 +184,14 @@ class PocketImport implements ImportInterface
             $label = trim($tag['tag']);
             $tagEntity = $this->em
                 ->getRepository('WallabagCoreBundle:Tag')
-                ->findOneByLabelAndUserId($label, $this->user->getId());
+                ->findOneByLabel($label);
 
             if (is_object($tagEntity)) {
                 $entry->addTag($tagEntity);
             } else {
-                $newTag = new Tag($this->user);
+                $newTag = new Tag();
                 $newTag->setLabel($label);
+
                 $entry->addTag($newTag);
             }
             $this->em->flush();
index 6ee70db047b0b7f61607f61a5ab3b76906fc24b7..1fc2dfa6c76237c57905ca24da6a553ee63eefe3 100644 (file)
@@ -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