diff options
Diffstat (limited to 'tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php')
-rw-r--r-- | tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php b/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php index bdc47dac..ada5493e 100644 --- a/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php | |||
@@ -120,6 +120,46 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase | |||
120 | $this->assertEquals(['skipped' => 0, 'imported' => 3], $wallabagV1Import->getSummary()); | 120 | $this->assertEquals(['skipped' => 0, 'imported' => 3], $wallabagV1Import->getSummary()); |
121 | } | 121 | } |
122 | 122 | ||
123 | public function testImportWithRabbit() | ||
124 | { | ||
125 | $wallabagV1Import = $this->getWallabagV1Import(); | ||
126 | $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v1.json'); | ||
127 | |||
128 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') | ||
129 | ->disableOriginalConstructor() | ||
130 | ->getMock(); | ||
131 | |||
132 | $entryRepo->expects($this->never()) | ||
133 | ->method('findByUrlAndUserId'); | ||
134 | |||
135 | $this->em | ||
136 | ->expects($this->never()) | ||
137 | ->method('getRepository'); | ||
138 | |||
139 | $entry = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Entry') | ||
140 | ->disableOriginalConstructor() | ||
141 | ->getMock(); | ||
142 | |||
143 | $this->contentProxy | ||
144 | ->expects($this->never()) | ||
145 | ->method('updateEntry'); | ||
146 | |||
147 | $producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer') | ||
148 | ->disableOriginalConstructor() | ||
149 | ->getMock(); | ||
150 | |||
151 | $producer | ||
152 | ->expects($this->exactly(4)) | ||
153 | ->method('publish'); | ||
154 | |||
155 | $wallabagV1Import->setRabbitmqProducer($producer); | ||
156 | |||
157 | $res = $wallabagV1Import->setMarkAsRead(true)->import(); | ||
158 | |||
159 | $this->assertTrue($res); | ||
160 | $this->assertEquals(['skipped' => 0, 'imported' => 4], $wallabagV1Import->getSummary()); | ||
161 | } | ||
162 | |||
123 | public function testImportBadFile() | 163 | public function testImportBadFile() |
124 | { | 164 | { |
125 | $wallabagV1Import = $this->getWallabagV1Import(); | 165 | $wallabagV1Import = $this->getWallabagV1Import(); |