aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
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
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')
-rw-r--r--tests/Wallabag/ImportBundle/Consumer/AMPQ/EntryConsumerTest.php225
-rw-r--r--tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php15
-rw-r--r--tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php16
-rw-r--r--tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php16
-rw-r--r--tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php16
-rw-r--r--tests/Wallabag/ImportBundle/Import/PocketImportTest.php81
-rw-r--r--tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php40
-rw-r--r--tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php40
-rw-r--r--tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php36
9 files changed, 485 insertions, 0 deletions
diff --git a/tests/Wallabag/ImportBundle/Consumer/AMPQ/EntryConsumerTest.php b/tests/Wallabag/ImportBundle/Consumer/AMPQ/EntryConsumerTest.php
new file mode 100644
index 00000000..7141874c
--- /dev/null
+++ b/tests/Wallabag/ImportBundle/Consumer/AMPQ/EntryConsumerTest.php
@@ -0,0 +1,225 @@
1<?php
2
3namespace Tests\Wallabag\ImportBundle\Consumer\AMQP;
4
5use Wallabag\ImportBundle\Consumer\AMPQ\EntryConsumer;
6use PhpAmqpLib\Message\AMQPMessage;
7use Wallabag\UserBundle\Entity\User;
8use Wallabag\CoreBundle\Entity\Entry;
9
10class EntryConsumerTest extends \PHPUnit_Framework_TestCase
11{
12 public function testMessageOk()
13 {
14 $em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
15 ->disableOriginalConstructor()
16 ->getMock();
17
18 $em
19 ->expects($this->once())
20 ->method('flush');
21
22 $em
23 ->expects($this->exactly(2))
24 ->method('clear');
25
26 $body = <<<'JSON'
27{
28 "item_id": "1402935436",
29 "resolved_id": "1402935436",
30 "given_url": "http://mashable.com/2016/09/04/leslie-jones-back-on-twitter-after-hack/?utm_campaign=Mash-Prod-RSS-Feedburner-All-Partial&utm_cid=Mash-Prod-RSS-Feedburner-All-Partial",
31 "given_title": "Leslie Jones is back on Twitter and her comeback tweet rules",
32 "favorite": "0",
33 "status": "0",
34 "time_added": "1473020899",
35 "time_updated": "1473020899",
36 "time_read": "0",
37 "time_favorited": "0",
38 "sort_id": 0,
39 "resolved_title": "Leslie Jones is back on Twitter and her comeback tweet rules",
40 "resolved_url": "http://mashable.com/2016/09/04/leslie-jones-back-on-twitter-after-hack/?utm_campaign=Mash-Prod-RSS-Feedburner-All-Partial&utm_cid=Mash-Prod-RSS-Feedburner-All-Partial",
41 "excerpt": "Leslie Jones is back to communicating with her adoring public on Twitter after cowardly hacker-trolls drove her away, probably to compensate for their own failings. It all started with a mic drop ...",
42 "is_article": "1",
43 "is_index": "0",
44 "has_video": "0",
45 "has_image": "1",
46 "word_count": "200",
47 "tags": {
48 "ifttt": {
49 "item_id": "1402935436",
50 "tag": "ifttt"
51 },
52 "mashable": {
53 "item_id": "1402935436",
54 "tag": "mashable"
55 }
56 },
57 "authors": {
58 "2484273": {
59 "item_id": "1402935436",
60 "author_id": "2484273",
61 "name": "Adam Rosenberg",
62 "url": "http://mashable.com/author/adam-rosenberg/"
63 }
64 },
65 "image": {
66 "item_id": "1402935436",
67 "src": "http://i.amz.mshcdn.com/i-V5cS6_sDqFABaVR0hVSBJqG_w=/950x534/https%3A%2F%2Fblueprint-api-production.s3.amazonaws.com%2Fuploads%2Fcard%2Fimage%2F199899%2Fleslie_jones_war_dogs.jpg",
68 "width": "0",
69 "height": "0"
70 },
71 "images": {
72 "1": {
73 "item_id": "1402935436",
74 "image_id": "1",
75 "src": "http://i.amz.mshcdn.com/i-V5cS6_sDqFABaVR0hVSBJqG_w=/950x534/https%3A%2F%2Fblueprint-api-production.s3.amazonaws.com%2Fuploads%2Fcard%2Fimage%2F199899%2Fleslie_jones_war_dogs.jpg",
76 "width": "0",
77 "height": "0",
78 "credit": "Image: Steve Eichner/NameFace/Sipa USA",
79 "caption": ""
80 }
81 },
82 "userId": 1
83}
84JSON;
85
86 $user = new User();
87 $entry = new Entry($user);
88
89 $userRepository = $this->getMockBuilder('Wallabag\UserBundle\Repository\UserRepository')
90 ->disableOriginalConstructor()
91 ->getMock();
92
93 $userRepository
94 ->expects($this->once())
95 ->method('find')
96 // userId from the body json above
97 ->with(1)
98 ->willReturn($user);
99
100 $import = $this->getMockBuilder('Wallabag\ImportBundle\Import\AbstractImport')
101 ->disableOriginalConstructor()
102 ->getMock();
103
104 $import
105 ->expects($this->once())
106 ->method('setUser')
107 ->with($user);
108
109 $import
110 ->expects($this->once())
111 ->method('parseEntry')
112 ->with(json_decode($body, true))
113 ->willReturn($entry);
114
115 $consumer = new EntryConsumer(
116 $em,
117 $userRepository,
118 $import
119 );
120
121 $message = new AMQPMessage($body);
122
123 $consumer->execute($message);
124 }
125
126 public function testMessageWithBadUser()
127 {
128 $em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
129 ->disableOriginalConstructor()
130 ->getMock();
131
132 $em
133 ->expects($this->never())
134 ->method('flush');
135
136 $em
137 ->expects($this->never())
138 ->method('clear');
139
140 $body = '{ "userId": 123 }';
141
142 $user = new User();
143 $entry = new Entry($user);
144
145 $userRepository = $this->getMockBuilder('Wallabag\UserBundle\Repository\UserRepository')
146 ->disableOriginalConstructor()
147 ->getMock();
148
149 $userRepository
150 ->expects($this->once())
151 ->method('find')
152 // userId from the body json above
153 ->with(123)
154 ->willReturn(null);
155
156 $import = $this->getMockBuilder('Wallabag\ImportBundle\Import\AbstractImport')
157 ->disableOriginalConstructor()
158 ->getMock();
159
160 $consumer = new EntryConsumer(
161 $em,
162 $userRepository,
163 $import
164 );
165
166 $message = new AMQPMessage($body);
167
168 $consumer->execute($message);
169 }
170
171 public function testMessageWithEntryProcessed()
172 {
173 $em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
174 ->disableOriginalConstructor()
175 ->getMock();
176
177 $em
178 ->expects($this->never())
179 ->method('flush');
180
181 $em
182 ->expects($this->never())
183 ->method('clear');
184
185 $body = '{ "userId": 123 }';
186
187 $user = new User();
188
189 $userRepository = $this->getMockBuilder('Wallabag\UserBundle\Repository\UserRepository')
190 ->disableOriginalConstructor()
191 ->getMock();
192
193 $userRepository
194 ->expects($this->once())
195 ->method('find')
196 // userId from the body json above
197 ->with(123)
198 ->willReturn($user);
199
200 $import = $this->getMockBuilder('Wallabag\ImportBundle\Import\AbstractImport')
201 ->disableOriginalConstructor()
202 ->getMock();
203
204 $import
205 ->expects($this->once())
206 ->method('setUser')
207 ->with($user);
208
209 $import
210 ->expects($this->once())
211 ->method('parseEntry')
212 ->with(json_decode($body, true))
213 ->willReturn(null);
214
215 $consumer = new EntryConsumer(
216 $em,
217 $userRepository,
218 $import
219 );
220
221 $message = new AMQPMessage($body);
222
223 $consumer->execute($message);
224 }
225}
diff --git a/tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php b/tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php
index e0e61df8..098cf356 100644
--- a/tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php
@@ -17,6 +17,21 @@ class PocketControllerTest extends WallabagCoreTestCase
17 $this->assertEquals(1, $crawler->filter('button[type=submit]')->count()); 17 $this->assertEquals(1, $crawler->filter('button[type=submit]')->count());
18 } 18 }
19 19
20 public function testImportPocketWithRabbitEnabled()
21 {
22 $this->logInAs('admin');
23 $client = $this->getClient();
24
25 $client->getContainer()->get('craue_config')->set('rabbitmq', 1);
26
27 $crawler = $client->request('GET', '/import/pocket');
28
29 $this->assertEquals(200, $client->getResponse()->getStatusCode());
30 $this->assertEquals(1, $crawler->filter('button[type=submit]')->count());
31
32 $client->getContainer()->get('craue_config')->set('rabbitmq', 0);
33 }
34
20 public function testImportPocketAuthBadToken() 35 public function testImportPocketAuthBadToken()
21 { 36 {
22 $this->logInAs('admin'); 37 $this->logInAs('admin');
diff --git a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
index fb39356a..e12a723d 100644
--- a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
@@ -19,6 +19,22 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
19 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 19 $this->assertEquals(1, $crawler->filter('input[type=file]')->count());
20 } 20 }
21 21
22 public function testImportReadabilityWithRabbitEnabled()
23 {
24 $this->logInAs('admin');
25 $client = $this->getClient();
26
27 $client->getContainer()->get('craue_config')->set('rabbitmq', 1);
28
29 $crawler = $client->request('GET', '/import/readability');
30
31 $this->assertEquals(200, $client->getResponse()->getStatusCode());
32 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
33 $this->assertEquals(1, $crawler->filter('input[type=file]')->count());
34
35 $client->getContainer()->get('craue_config')->set('rabbitmq', 0);
36 }
37
22 public function testImportReadabilityWithFile() 38 public function testImportReadabilityWithFile()
23 { 39 {
24 $this->logInAs('admin'); 40 $this->logInAs('admin');
diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
index ff1bf6f0..96556717 100644
--- a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
@@ -19,6 +19,22 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
19 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 19 $this->assertEquals(1, $crawler->filter('input[type=file]')->count());
20 } 20 }
21 21
22 public function testImportWallabagWithRabbitEnabled()
23 {
24 $this->logInAs('admin');
25 $client = $this->getClient();
26
27 $client->getContainer()->get('craue_config')->set('rabbitmq', 1);
28
29 $crawler = $client->request('GET', '/import/wallabag-v1');
30
31 $this->assertEquals(200, $client->getResponse()->getStatusCode());
32 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
33 $this->assertEquals(1, $crawler->filter('input[type=file]')->count());
34
35 $client->getContainer()->get('craue_config')->set('rabbitmq', 0);
36 }
37
22 public function testImportWallabagWithFile() 38 public function testImportWallabagWithFile()
23 { 39 {
24 $this->logInAs('admin'); 40 $this->logInAs('admin');
diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
index 149e88bb..250d0d3e 100644
--- a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
@@ -19,6 +19,22 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
19 $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); 19 $this->assertEquals(1, $crawler->filter('input[type=file]')->count());
20 } 20 }
21 21
22 public function testImportWallabagWithRabbitEnabled()
23 {
24 $this->logInAs('admin');
25 $client = $this->getClient();
26
27 $client->getContainer()->get('craue_config')->set('rabbitmq', 1);
28
29 $crawler = $client->request('GET', '/import/wallabag-v2');
30
31 $this->assertEquals(200, $client->getResponse()->getStatusCode());
32 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
33 $this->assertEquals(1, $crawler->filter('input[type=file]')->count());
34
35 $client->getContainer()->get('craue_config')->set('rabbitmq', 0);
36 }
37
22 public function testImportWallabagWithFile() 38 public function testImportWallabagWithFile()
23 { 39 {
24 $this->logInAs('admin'); 40 $this->logInAs('admin');
diff --git a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
index 26c6b825..5ad3e435 100644
--- a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
@@ -343,6 +343,87 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
343 $this->assertEquals(['skipped' => 0, 'imported' => 2], $pocketImport->getSummary()); 343 $this->assertEquals(['skipped' => 0, 'imported' => 2], $pocketImport->getSummary());
344 } 344 }
345 345
346 /**
347 * Will sample results from https://getpocket.com/developer/docs/v3/retrieve.
348 */
349 public function testImportWithRabbit()
350 {
351 $client = new Client();
352
353 $body = <<<'JSON'
354{
355 "item_id": "229279689",
356 "resolved_id": "229279689",
357 "given_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview",
358 "given_title": "The Massive Ryder Cup Preview - The Triangle Blog - Grantland",
359 "favorite": "1",
360 "status": "1",
361 "resolved_title": "The Massive Ryder Cup Preview",
362 "resolved_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview",
363 "excerpt": "The list of things I love about the Ryder Cup is so long that it could fill a (tedious) novel, and golf fans can probably guess most of them.",
364 "is_article": "1",
365 "has_video": "0",
366 "has_image": "0",
367 "word_count": "3197"
368}
369JSON;
370
371 $mock = new Mock([
372 new Response(200, ['Content-Type' => 'application/json'], Stream::factory(json_encode(['access_token' => 'wunderbar_token']))),
373 new Response(200, ['Content-Type' => 'application/json'], Stream::factory('
374 {
375 "status": 1,
376 "list": {
377 "229279690": '.$body.'
378 }
379 }
380 ')),
381 ]);
382
383 $client->getEmitter()->attach($mock);
384
385 $pocketImport = $this->getPocketImport();
386
387 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
388 ->disableOriginalConstructor()
389 ->getMock();
390
391 $entryRepo->expects($this->never())
392 ->method('findByUrlAndUserId');
393
394 $this->em
395 ->expects($this->never())
396 ->method('getRepository');
397
398 $entry = new Entry($this->user);
399
400 $this->contentProxy
401 ->expects($this->never())
402 ->method('updateEntry');
403
404 $producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
405 ->disableOriginalConstructor()
406 ->getMock();
407
408 $bodyAsArray = json_decode($body, true);
409 // because with just use `new User()` so it doesn't have an id
410 $bodyAsArray['userId'] = null;
411
412 $producer
413 ->expects($this->once())
414 ->method('publish')
415 ->with(json_encode($bodyAsArray));
416
417 $pocketImport->setClient($client);
418 $pocketImport->setRabbitmqProducer($producer);
419 $pocketImport->authorize('wunderbar_code');
420
421 $res = $pocketImport->setMarkAsRead(true)->import();
422
423 $this->assertTrue($res);
424 $this->assertEquals(['skipped' => 0, 'imported' => 1], $pocketImport->getSummary());
425 }
426
346 public function testImportBadResponse() 427 public function testImportBadResponse()
347 { 428 {
348 $client = new Client(); 429 $client = new Client();
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();
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();
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();