diff options
author | Jérémy Benoist <j0k3r@users.noreply.github.com> | 2017-05-31 17:26:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-31 17:26:05 +0200 |
commit | ec8e7ffad48c9920b4b63b8e278c8bec1fc6f480 (patch) | |
tree | 1f4387becf57b376759e72c6a8de28693776de6d /tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php | |
parent | 4423b88c5b2c2d530b0a83a822f521a61ca4d4b8 (diff) | |
parent | 4368a27152021fd5a5ac09109eb0260d69c54c3c (diff) | |
download | wallabag-ec8e7ffad48c9920b4b63b8e278c8bec1fc6f480.tar.gz wallabag-ec8e7ffad48c9920b4b63b8e278c8bec1fc6f480.tar.zst wallabag-ec8e7ffad48c9920b4b63b8e278c8bec1fc6f480.zip |
Merge pull request #3106 from wallabag/api-content
Allow other fields to be send using API
Diffstat (limited to 'tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php')
-rw-r--r-- | tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php b/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php index 9f0c5bac..7cbef637 100644 --- a/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php | |||
@@ -82,14 +82,14 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase | |||
82 | 82 | ||
83 | public function testImport() | 83 | public function testImport() |
84 | { | 84 | { |
85 | $wallabagV1Import = $this->getWallabagV1Import(false, 3); | 85 | $wallabagV1Import = $this->getWallabagV1Import(false, 1); |
86 | $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v1.json'); | 86 | $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v1.json'); |
87 | 87 | ||
88 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') | 88 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') |
89 | ->disableOriginalConstructor() | 89 | ->disableOriginalConstructor() |
90 | ->getMock(); | 90 | ->getMock(); |
91 | 91 | ||
92 | $entryRepo->expects($this->exactly(4)) | 92 | $entryRepo->expects($this->exactly(2)) |
93 | ->method('findByUrlAndUserId') | 93 | ->method('findByUrlAndUserId') |
94 | ->will($this->onConsecutiveCalls(false, true, false, false)); | 94 | ->will($this->onConsecutiveCalls(false, true, false, false)); |
95 | 95 | ||
@@ -103,14 +103,14 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase | |||
103 | ->getMock(); | 103 | ->getMock(); |
104 | 104 | ||
105 | $this->contentProxy | 105 | $this->contentProxy |
106 | ->expects($this->exactly(3)) | 106 | ->expects($this->exactly(1)) |
107 | ->method('updateEntry') | 107 | ->method('updateEntry') |
108 | ->willReturn($entry); | 108 | ->willReturn($entry); |
109 | 109 | ||
110 | $res = $wallabagV1Import->import(); | 110 | $res = $wallabagV1Import->import(); |
111 | 111 | ||
112 | $this->assertTrue($res); | 112 | $this->assertTrue($res); |
113 | $this->assertEquals(['skipped' => 1, 'imported' => 3, 'queued' => 0], $wallabagV1Import->getSummary()); | 113 | $this->assertEquals(['skipped' => 1, 'imported' => 1, 'queued' => 0], $wallabagV1Import->getSummary()); |
114 | } | 114 | } |
115 | 115 | ||
116 | public function testImportAndMarkAllAsRead() | 116 | public function testImportAndMarkAllAsRead() |
@@ -180,7 +180,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase | |||
180 | ->getMock(); | 180 | ->getMock(); |
181 | 181 | ||
182 | $producer | 182 | $producer |
183 | ->expects($this->exactly(4)) | 183 | ->expects($this->exactly(2)) |
184 | ->method('publish'); | 184 | ->method('publish'); |
185 | 185 | ||
186 | $wallabagV1Import->setProducer($producer); | 186 | $wallabagV1Import->setProducer($producer); |
@@ -188,7 +188,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase | |||
188 | $res = $wallabagV1Import->setMarkAsRead(true)->import(); | 188 | $res = $wallabagV1Import->setMarkAsRead(true)->import(); |
189 | 189 | ||
190 | $this->assertTrue($res); | 190 | $this->assertTrue($res); |
191 | $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 4], $wallabagV1Import->getSummary()); | 191 | $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 2], $wallabagV1Import->getSummary()); |
192 | } | 192 | } |
193 | 193 | ||
194 | public function testImportWithRedis() | 194 | public function testImportWithRedis() |
@@ -226,7 +226,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase | |||
226 | $res = $wallabagV1Import->setMarkAsRead(true)->import(); | 226 | $res = $wallabagV1Import->setMarkAsRead(true)->import(); |
227 | 227 | ||
228 | $this->assertTrue($res); | 228 | $this->assertTrue($res); |
229 | $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 4], $wallabagV1Import->getSummary()); | 229 | $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 2], $wallabagV1Import->getSummary()); |
230 | 230 | ||
231 | $this->assertNotEmpty($redisMock->lpop('wallabag_v1')); | 231 | $this->assertNotEmpty($redisMock->lpop('wallabag_v1')); |
232 | } | 232 | } |