mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-22 23:56:29 +00:00
Fix tag related test for Pocket
This commit is contained in:
parent
5b2b5858fe
commit
c5c7f90a81
2 changed files with 6 additions and 3 deletions
|
@ -184,13 +184,14 @@ class PocketImport implements ImportInterface
|
||||||
$label = trim($tag['tag']);
|
$label = trim($tag['tag']);
|
||||||
$tagEntity = $this->em
|
$tagEntity = $this->em
|
||||||
->getRepository('WallabagCoreBundle:Tag')
|
->getRepository('WallabagCoreBundle:Tag')
|
||||||
->findOneByLabelAndUserId($label, $this->user->getId());
|
->findOneByLabel($label);
|
||||||
|
|
||||||
if (is_object($tagEntity)) {
|
if (is_object($tagEntity)) {
|
||||||
$entry->addTag($tagEntity);
|
$entry->addTag($tagEntity);
|
||||||
} else {
|
} else {
|
||||||
$newTag = new Tag($this->user);
|
$newTag = new Tag();
|
||||||
$newTag->setLabel($label);
|
$newTag->setLabel($label);
|
||||||
|
|
||||||
$entry->addTag($newTag);
|
$entry->addTag($newTag);
|
||||||
}
|
}
|
||||||
$this->em->flush();
|
$this->em->flush();
|
||||||
|
|
|
@ -260,7 +260,9 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$tagRepo->expects($this->exactly(2))
|
$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));
|
->will($this->onConsecutiveCalls(false, $tag));
|
||||||
|
|
||||||
$this->em
|
$this->em
|
||||||
|
|
Loading…
Reference in a new issue