aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.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/ReadabilityImportTest.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/ReadabilityImportTest.php')
-rw-r--r--tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
index 706d707b..69a66d6a 100644
--- a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
@@ -120,6 +120,46 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
120 $this->assertEquals(['skipped' => 0, 'imported' => 2], $readabilityImport->getSummary()); 120 $this->assertEquals(['skipped' => 0, 'imported' => 2], $readabilityImport->getSummary());
121 } 121 }
122 122
123 public function testImportWithRabbit()
124 {
125 $readabilityImport = $this->getReadabilityImport();
126 $readabilityImport->setFilepath(__DIR__.'/../fixtures/readability.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(2))
153 ->method('publish');
154
155 $readabilityImport->setRabbitmqProducer($producer);
156
157 $res = $readabilityImport->setMarkAsRead(true)->import();
158
159 $this->assertTrue($res);
160 $this->assertEquals(['skipped' => 0, 'imported' => 2], $readabilityImport->getSummary());
161 }
162
123 public function testImportBadFile() 163 public function testImportBadFile()
124 { 164 {
125 $readabilityImport = $this->getReadabilityImport(); 165 $readabilityImport = $this->getReadabilityImport();