diff options
Diffstat (limited to 'src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php')
-rw-r--r-- | src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php index 3268cd3e..c461168c 100644 --- a/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php +++ b/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php | |||
@@ -72,6 +72,39 @@ 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 | // check that every entry persisted are archived | ||
94 | $this->em | ||
95 | ->expects($this->any()) | ||
96 | ->method('persist') | ||
97 | ->with($this->callback(function($persistedEntry) { | ||
98 | return $persistedEntry->isArchived(); | ||
99 | })); | ||
100 | |||
101 | $res = $wallabagV2Import->setMarkAsRead(true)->import(); | ||
102 | |||
103 | $this->assertTrue($res); | ||
104 | |||
105 | $this->assertEquals(['skipped' => 0, 'imported' => 2], $wallabagV2Import->getSummary()); | ||
106 | } | ||
107 | |||
75 | public function testImportBadFile() | 108 | public function testImportBadFile() |
76 | { | 109 | { |
77 | $wallabagV1Import = $this->getWallabagV2Import(); | 110 | $wallabagV1Import = $this->getWallabagV2Import(); |