diff options
Diffstat (limited to 'tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php')
-rw-r--r-- | tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php b/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php index 4a45e0f0..51f0aada 100644 --- a/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php | |||
@@ -116,6 +116,42 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase | |||
116 | $this->assertEquals(['skipped' => 0, 'imported' => 2], $wallabagV2Import->getSummary()); | 116 | $this->assertEquals(['skipped' => 0, 'imported' => 2], $wallabagV2Import->getSummary()); |
117 | } | 117 | } |
118 | 118 | ||
119 | public function testImportWithRabbit() | ||
120 | { | ||
121 | $wallabagV2Import = $this->getWallabagV2Import(); | ||
122 | $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.json'); | ||
123 | |||
124 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') | ||
125 | ->disableOriginalConstructor() | ||
126 | ->getMock(); | ||
127 | |||
128 | $entryRepo->expects($this->never()) | ||
129 | ->method('findByUrlAndUserId'); | ||
130 | |||
131 | $this->em | ||
132 | ->expects($this->never()) | ||
133 | ->method('getRepository'); | ||
134 | |||
135 | $this->contentProxy | ||
136 | ->expects($this->never()) | ||
137 | ->method('updateEntry'); | ||
138 | |||
139 | $producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer') | ||
140 | ->disableOriginalConstructor() | ||
141 | ->getMock(); | ||
142 | |||
143 | $producer | ||
144 | ->expects($this->exactly(24)) | ||
145 | ->method('publish'); | ||
146 | |||
147 | $wallabagV2Import->setRabbitmqProducer($producer); | ||
148 | |||
149 | $res = $wallabagV2Import->setMarkAsRead(true)->import(); | ||
150 | |||
151 | $this->assertTrue($res); | ||
152 | $this->assertEquals(['skipped' => 0, 'imported' => 24], $wallabagV2Import->getSummary()); | ||
153 | } | ||
154 | |||
119 | public function testImportBadFile() | 155 | public function testImportBadFile() |
120 | { | 156 | { |
121 | $wallabagV1Import = $this->getWallabagV2Import(); | 157 | $wallabagV1Import = $this->getWallabagV2Import(); |