diff options
author | Thomas Citharel <tcit@tcit.fr> | 2016-02-13 16:20:00 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-03-03 10:03:40 +0100 |
commit | c32ae320fec4135f5b32d57ef88349317a3b1f3f (patch) | |
tree | a55f5d4ca0c77c40822f2d53faa9dd622064be3f /src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php | |
parent | c10fcb3bbbd4ef14edd9a862ee18c895d92e30ae (diff) | |
download | wallabag-c32ae320fec4135f5b32d57ef88349317a3b1f3f.tar.gz wallabag-c32ae320fec4135f5b32d57ef88349317a3b1f3f.tar.zst wallabag-c32ae320fec4135f5b32d57ef88349317a3b1f3f.zip |
cs & tests for wllbg v1 import
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(); |