diff options
Diffstat (limited to 'src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php')
-rw-r--r-- | src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php index 9a563a11..fbcd270d 100644 --- a/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php +++ b/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php | |||
@@ -81,6 +81,39 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase | |||
81 | $this->assertEquals(['skipped' => 1, 'imported' => 3], $wallabagV1Import->getSummary()); | 81 | $this->assertEquals(['skipped' => 1, 'imported' => 3], $wallabagV1Import->getSummary()); |
82 | } | 82 | } |
83 | 83 | ||
84 | public function testImportAndMarkAllAsRead() | ||
85 | { | ||
86 | $wallabagV1Import = $this->getWallabagV1Import(); | ||
87 | $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v1-read.json'); | ||
88 | |||
89 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') | ||
90 | ->disableOriginalConstructor() | ||
91 | ->getMock(); | ||
92 | |||
93 | $entryRepo->expects($this->exactly(3)) | ||
94 | ->method('findByUrlAndUserId') | ||
95 | ->will($this->onConsecutiveCalls(false, false, false)); | ||
96 | |||
97 | $this->em | ||
98 | ->expects($this->any()) | ||
99 | ->method('getRepository') | ||
100 | ->willReturn($entryRepo); | ||
101 | |||
102 | // check that every entry persisted are archived | ||
103 | $this->em | ||
104 | ->expects($this->any()) | ||
105 | ->method('persist') | ||
106 | ->with($this->callback(function($persistedEntry) { | ||
107 | return $persistedEntry->isArchived(); | ||
108 | })); | ||
109 | |||
110 | $res = $wallabagV1Import->setMarkAsRead(true)->import(); | ||
111 | |||
112 | $this->assertTrue($res); | ||
113 | |||
114 | $this->assertEquals(['skipped' => 0, 'imported' => 3], $wallabagV1Import->getSummary()); | ||
115 | } | ||
116 | |||
84 | public function testImportBadFile() | 117 | public function testImportBadFile() |
85 | { | 118 | { |
86 | $wallabagV1Import = $this->getWallabagV1Import(); | 119 | $wallabagV1Import = $this->getWallabagV1Import(); |