diff options
Diffstat (limited to 'src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php')
-rw-r--r-- | src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php index 3268cd3e..8728364b 100644 --- a/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php +++ b/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php | |||
@@ -72,6 +72,36 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase | |||
72 | $this->assertEquals(['skipped' => 1, 'imported' => 2], $wallabagV2Import->getSummary()); | 72 | $this->assertEquals(['skipped' => 1, 'imported' => 2], $wallabagV2Import->getSummary()); |
73 | } | 73 | } |
74 | 74 | ||
75 | public function testImportAndMarkAllAsRead() | ||
76 | { | ||
77 | $wallabagV2Import = $this->getWallabagV2Import(); | ||
78 | $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2-read.json'); | ||
79 | |||
80 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') | ||
81 | ->disableOriginalConstructor() | ||
82 | ->getMock(); | ||
83 | |||
84 | $entryRepo->expects($this->exactly(2)) | ||
85 | ->method('findByUrlAndUserId') | ||
86 | ->will($this->onConsecutiveCalls(false, false)); | ||
87 | |||
88 | $this->em | ||
89 | ->expects($this->any()) | ||
90 | ->method('getRepository') | ||
91 | ->willReturn($entryRepo); | ||
92 | |||
93 | $res = $wallabagV2Import->setMarkAsRead(true)->import(); | ||
94 | |||
95 | $this->assertTrue($res); | ||
96 | |||
97 | $this->em | ||
98 | ->expects($this->any()) | ||
99 | ->method('getBuilderForArchiveByUser') | ||
100 | ->willReturn($entryRepo); | ||
101 | |||
102 | $this->assertEquals(['skipped' => 0, 'imported' => 2], $wallabagV2Import->getSummary()); | ||
103 | } | ||
104 | |||
75 | public function testImportBadFile() | 105 | public function testImportBadFile() |
76 | { | 106 | { |
77 | $wallabagV1Import = $this->getWallabagV2Import(); | 107 | $wallabagV1Import = $this->getWallabagV2Import(); |