protected $em;
protected $logHandler;
protected $contentProxy;
+ protected $tagsAssigner;
+ protected $uow;
private function getWallabagV2Import($unsetUser = false, $dispatched = 0)
{
->disableOriginalConstructor()
->getMock();
+ $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
+ ->disableOriginalConstructor()
+ ->getMock();
+
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
->disableOriginalConstructor()
->getMock();
->expects($this->exactly($dispatched))
->method('dispatch');
- $wallabag = new WallabagV2Import($this->em, $this->contentProxy, $dispatcher);
+ $wallabag = new WallabagV2Import($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
$this->logHandler = new TestHandler();
$logger = new Logger('test', [$this->logHandler]);
->disableOriginalConstructor()
->getMock();
- $entryRepo->expects($this->exactly(24))
+ $entryRepo->expects($this->exactly(6))
->method('findByUrlAndUserId')
->will($this->onConsecutiveCalls(false, true, false));
$res = $wallabagV2Import->import();
$this->assertTrue($res);
- $this->assertEquals(['skipped' => 22, 'imported' => 2, 'queued' => 0], $wallabagV2Import->getSummary());
+ $this->assertEquals(['skipped' => 4, 'imported' => 2, 'queued' => 0], $wallabagV2Import->getSummary());
}
public function testImportAndMarkAllAsRead()
->getMock();
$producer
- ->expects($this->exactly(24))
+ ->expects($this->exactly(6))
->method('publish');
$wallabagV2Import->setProducer($producer);
$res = $wallabagV2Import->setMarkAsRead(true)->import();
$this->assertTrue($res);
- $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 24], $wallabagV2Import->getSummary());
+ $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 6], $wallabagV2Import->getSummary());
}
public function testImportWithRedis()
$res = $wallabagV2Import->setMarkAsRead(true)->import();
$this->assertTrue($res);
- $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 24], $wallabagV2Import->getSummary());
+ $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 6], $wallabagV2Import->getSummary());
$this->assertNotEmpty($redisMock->lpop('wallabag_v2'));
}
->disableOriginalConstructor()
->getMock();
- $entryRepo->expects($this->exactly(24))
+ $entryRepo->expects($this->exactly(6))
->method('findByUrlAndUserId')
->will($this->onConsecutiveCalls(false, true, false));
$res = $wallabagV2Import->import();
$this->assertTrue($res);
- $this->assertEquals(['skipped' => 22, 'imported' => 2, 'queued' => 0], $wallabagV2Import->getSummary());
+ $this->assertEquals(['skipped' => 4, 'imported' => 2, 'queued' => 0], $wallabagV2Import->getSummary());
}
}