aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-09-09 18:02:29 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-09-11 21:58:56 +0200
commit13470c3596d0b1490bbf18b39128a05bbb3c7f3e (patch)
tree962028a191b644653e6c9b2b536189ded89c3017 /tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php
parent8664069e1aa2fa89e17587308a03f2720c20327a (diff)
downloadwallabag-13470c3596d0b1490bbf18b39128a05bbb3c7f3e.tar.gz
wallabag-13470c3596d0b1490bbf18b39128a05bbb3c7f3e.tar.zst
wallabag-13470c3596d0b1490bbf18b39128a05bbb3c7f3e.zip
Add test for RabbitMQ
Also update Symfony deps
Diffstat (limited to 'tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php')
-rw-r--r--tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php40
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();