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/WallabagV2ImportTest.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/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(); |