diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-03-04 16:12:45 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-03-04 16:12:45 +0100 |
commit | d89908aed331779fc79b8e50ddaa51212b6269f5 (patch) | |
tree | 8087d461437d315440c825ab28433e62ce799ecc /src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php | |
parent | e18138dbca536ebd49c938144f9d051e5276d4ea (diff) | |
parent | 79d0e38e7ff975b2e0306d3dd96f57509fd84aef (diff) | |
download | wallabag-d89908aed331779fc79b8e50ddaa51212b6269f5.tar.gz wallabag-d89908aed331779fc79b8e50ddaa51212b6269f5.tar.zst wallabag-d89908aed331779fc79b8e50ddaa51212b6269f5.zip |
Merge pull request #1670 from wallabag/v2-mark-imported-articles-as-read
Mark all imported articles as read
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(); |