add tests

This commit is contained in:
Thomas Citharel
2016-02-11 15:48:20 +01:00
parent da0a9e01e9
commit eaf9dad777
5 changed files with 75 additions and 12 deletions

View File

@ -57,19 +57,28 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor()
->getMock();
$entryRepo->expects($this->exactly(3))
$entryRepo->expects($this->exactly(4))
->method('findByUrlAndUserId')
->will($this->onConsecutiveCalls(false, true, false));
->will($this->onConsecutiveCalls(false, true, false, false));
$this->em
->expects($this->any())
->method('getRepository')
->willReturn($entryRepo);
$entry = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Entry')
->disableOriginalConstructor()
->getMock();
$this->contentProxy
->expects($this->once())
->method('updateEntry')
->willReturn($entry);
$res = $wallabagV1Import->import();
$this->assertTrue($res);
$this->assertEquals(['skipped' => 1, 'imported' => 2], $wallabagV1Import->getSummary());
$this->assertEquals(['skipped' => 1, 'imported' => 3], $wallabagV1Import->getSummary());
}
public function testImportBadFile()