diff options
-rw-r--r-- | src/Wallabag/ImportBundle/Import/PocketImport.php | 5 | ||||
-rw-r--r-- | src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php index b1c5bb00..853ad135 100644 --- a/src/Wallabag/ImportBundle/Import/PocketImport.php +++ b/src/Wallabag/ImportBundle/Import/PocketImport.php | |||
@@ -184,13 +184,14 @@ class PocketImport implements ImportInterface | |||
184 | $label = trim($tag['tag']); | 184 | $label = trim($tag['tag']); |
185 | $tagEntity = $this->em | 185 | $tagEntity = $this->em |
186 | ->getRepository('WallabagCoreBundle:Tag') | 186 | ->getRepository('WallabagCoreBundle:Tag') |
187 | ->findOneByLabelAndUserId($label, $this->user->getId()); | 187 | ->findOneByLabel($label); |
188 | 188 | ||
189 | if (is_object($tagEntity)) { | 189 | if (is_object($tagEntity)) { |
190 | $entry->addTag($tagEntity); | 190 | $entry->addTag($tagEntity); |
191 | } else { | 191 | } else { |
192 | $newTag = new Tag($this->user); | 192 | $newTag = new Tag(); |
193 | $newTag->setLabel($label); | 193 | $newTag->setLabel($label); |
194 | |||
194 | $entry->addTag($newTag); | 195 | $entry->addTag($newTag); |
195 | } | 196 | } |
196 | $this->em->flush(); | 197 | $this->em->flush(); |
diff --git a/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php index 6ee70db0..1fc2dfa6 100644 --- a/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php +++ b/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php | |||
@@ -260,7 +260,9 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase | |||
260 | ->getMock(); | 260 | ->getMock(); |
261 | 261 | ||
262 | $tagRepo->expects($this->exactly(2)) | 262 | $tagRepo->expects($this->exactly(2)) |
263 | ->method('findOneByLabelAndUserId') | 263 | // the method `findOneByLabel` doesn't exist, EntityRepository will then call `_call` method |
264 | // to magically call the `findOneBy` with ['label' => 'foo'] | ||
265 | ->method('__call') | ||
264 | ->will($this->onConsecutiveCalls(false, $tag)); | 266 | ->will($this->onConsecutiveCalls(false, $tag)); |
265 | 267 | ||
266 | $this->em | 268 | $this->em |