aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/ImportBundle
diff options
context:
space:
mode:
authorJerome Charaoui <jerome@riseup.net>2016-12-07 15:16:49 -0500
committerJeremy Benoist <jbenoist@20minutes.fr>2017-06-01 09:48:14 +0200
commitd0e9b3d640acce49068d1a2c5603b92c1bda363e (patch)
tree1b992438ca153c18596f88ee7bec7d98b8984264 /tests/Wallabag/ImportBundle
parent1c5da417e4ddb14223f9af6e5cea6778e5c0fd08 (diff)
downloadwallabag-d0e9b3d640acce49068d1a2c5603b92c1bda363e.tar.gz
wallabag-d0e9b3d640acce49068d1a2c5603b92c1bda363e.tar.zst
wallabag-d0e9b3d640acce49068d1a2c5603b92c1bda363e.zip
Add disableContentUpdate import option
This commit also decouples the "import" and "update" functions inside ContentProxy. If a content array is available, it must be passed to the new importEntry method.
Diffstat (limited to 'tests/Wallabag/ImportBundle')
-rw-r--r--tests/Wallabag/ImportBundle/Import/ChromeImportTest.php8
-rw-r--r--tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php8
-rw-r--r--tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php8
-rw-r--r--tests/Wallabag/ImportBundle/Import/PocketImportTest.php10
-rw-r--r--tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php8
-rw-r--r--tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php8
-rw-r--r--tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php10
7 files changed, 30 insertions, 30 deletions
diff --git a/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php b/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php
index cec19534..7a15e918 100644
--- a/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php
@@ -89,7 +89,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase
89 89
90 $this->contentProxy 90 $this->contentProxy
91 ->expects($this->exactly(1)) 91 ->expects($this->exactly(1))
92 ->method('updateEntry') 92 ->method('importEntry')
93 ->willReturn($entry); 93 ->willReturn($entry);
94 94
95 $res = $chromeImport->import(); 95 $res = $chromeImport->import();
@@ -118,7 +118,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase
118 118
119 $this->contentProxy 119 $this->contentProxy
120 ->expects($this->exactly(1)) 120 ->expects($this->exactly(1))
121 ->method('updateEntry') 121 ->method('importEntry')
122 ->willReturn(new Entry($this->user)); 122 ->willReturn(new Entry($this->user));
123 123
124 // check that every entry persisted are archived 124 // check that every entry persisted are archived
@@ -158,7 +158,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase
158 158
159 $this->contentProxy 159 $this->contentProxy
160 ->expects($this->never()) 160 ->expects($this->never())
161 ->method('updateEntry'); 161 ->method('importEntry');
162 162
163 $producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer') 163 $producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
164 ->disableOriginalConstructor() 164 ->disableOriginalConstructor()
@@ -198,7 +198,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase
198 198
199 $this->contentProxy 199 $this->contentProxy
200 ->expects($this->never()) 200 ->expects($this->never())
201 ->method('updateEntry'); 201 ->method('importEntry');
202 202
203 $factory = new RedisMockFactory(); 203 $factory = new RedisMockFactory();
204 $redisMock = $factory->getAdapter('Predis\Client', true); 204 $redisMock = $factory->getAdapter('Predis\Client', true);
diff --git a/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php b/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php
index c186c820..09abac57 100644
--- a/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php
@@ -89,7 +89,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
89 89
90 $this->contentProxy 90 $this->contentProxy
91 ->expects($this->exactly(2)) 91 ->expects($this->exactly(2))
92 ->method('updateEntry') 92 ->method('importEntry')
93 ->willReturn($entry); 93 ->willReturn($entry);
94 94
95 $res = $firefoxImport->import(); 95 $res = $firefoxImport->import();
@@ -118,7 +118,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
118 118
119 $this->contentProxy 119 $this->contentProxy
120 ->expects($this->exactly(1)) 120 ->expects($this->exactly(1))
121 ->method('updateEntry') 121 ->method('importEntry')
122 ->willReturn(new Entry($this->user)); 122 ->willReturn(new Entry($this->user));
123 123
124 // check that every entry persisted are archived 124 // check that every entry persisted are archived
@@ -158,7 +158,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
158 158
159 $this->contentProxy 159 $this->contentProxy
160 ->expects($this->never()) 160 ->expects($this->never())
161 ->method('updateEntry'); 161 ->method('importEntry');
162 162
163 $producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer') 163 $producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
164 ->disableOriginalConstructor() 164 ->disableOriginalConstructor()
@@ -198,7 +198,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
198 198
199 $this->contentProxy 199 $this->contentProxy
200 ->expects($this->never()) 200 ->expects($this->never())
201 ->method('updateEntry'); 201 ->method('importEntry');
202 202
203 $factory = new RedisMockFactory(); 203 $factory = new RedisMockFactory();
204 $redisMock = $factory->getAdapter('Predis\Client', true); 204 $redisMock = $factory->getAdapter('Predis\Client', true);
diff --git a/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php b/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php
index 9158c8a2..05844490 100644
--- a/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php
@@ -104,7 +104,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
104 104
105 $this->contentProxy 105 $this->contentProxy
106 ->expects($this->exactly(4)) 106 ->expects($this->exactly(4))
107 ->method('updateEntry') 107 ->method('importEntry')
108 ->willReturn($entry); 108 ->willReturn($entry);
109 109
110 $res = $instapaperImport->import(); 110 $res = $instapaperImport->import();
@@ -133,7 +133,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
133 133
134 $this->contentProxy 134 $this->contentProxy
135 ->expects($this->once()) 135 ->expects($this->once())
136 ->method('updateEntry') 136 ->method('importEntry')
137 ->willReturn(new Entry($this->user)); 137 ->willReturn(new Entry($this->user));
138 138
139 // check that every entry persisted are archived 139 // check that every entry persisted are archived
@@ -173,7 +173,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
173 173
174 $this->contentProxy 174 $this->contentProxy
175 ->expects($this->never()) 175 ->expects($this->never())
176 ->method('updateEntry'); 176 ->method('importEntry');
177 177
178 $producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer') 178 $producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
179 ->disableOriginalConstructor() 179 ->disableOriginalConstructor()
@@ -213,7 +213,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
213 213
214 $this->contentProxy 214 $this->contentProxy
215 ->expects($this->never()) 215 ->expects($this->never())
216 ->method('updateEntry'); 216 ->method('importEntry');
217 217
218 $factory = new RedisMockFactory(); 218 $factory = new RedisMockFactory();
219 $redisMock = $factory->getAdapter('Predis\Client', true); 219 $redisMock = $factory->getAdapter('Predis\Client', true);
diff --git a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
index b81ebe15..f75e6bea 100644
--- a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
@@ -282,7 +282,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
282 282
283 $this->contentProxy 283 $this->contentProxy
284 ->expects($this->once()) 284 ->expects($this->once())
285 ->method('updateEntry') 285 ->method('importEntry')
286 ->willReturn($entry); 286 ->willReturn($entry);
287 287
288 $pocketImport->setClient($client); 288 $pocketImport->setClient($client);
@@ -377,7 +377,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
377 377
378 $this->contentProxy 378 $this->contentProxy
379 ->expects($this->exactly(2)) 379 ->expects($this->exactly(2))
380 ->method('updateEntry') 380 ->method('importEntry')
381 ->willReturn($entry); 381 ->willReturn($entry);
382 382
383 $pocketImport->setClient($client); 383 $pocketImport->setClient($client);
@@ -450,7 +450,7 @@ JSON;
450 450
451 $this->contentProxy 451 $this->contentProxy
452 ->expects($this->never()) 452 ->expects($this->never())
453 ->method('updateEntry'); 453 ->method('importEntry');
454 454
455 $producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer') 455 $producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
456 ->disableOriginalConstructor() 456 ->disableOriginalConstructor()
@@ -536,7 +536,7 @@ JSON;
536 536
537 $this->contentProxy 537 $this->contentProxy
538 ->expects($this->never()) 538 ->expects($this->never())
539 ->method('updateEntry'); 539 ->method('ImportEntry');
540 540
541 $factory = new RedisMockFactory(); 541 $factory = new RedisMockFactory();
542 $redisMock = $factory->getAdapter('Predis\Client', true); 542 $redisMock = $factory->getAdapter('Predis\Client', true);
@@ -621,7 +621,7 @@ JSON;
621 621
622 $this->contentProxy 622 $this->contentProxy
623 ->expects($this->once()) 623 ->expects($this->once())
624 ->method('updateEntry') 624 ->method('importEntry')
625 ->will($this->throwException(new \Exception())); 625 ->will($this->throwException(new \Exception()));
626 626
627 $pocketImport->setClient($client); 627 $pocketImport->setClient($client);
diff --git a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
index 8f466d38..1b0daa92 100644
--- a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
@@ -89,7 +89,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
89 89
90 $this->contentProxy 90 $this->contentProxy
91 ->expects($this->exactly(3)) 91 ->expects($this->exactly(3))
92 ->method('updateEntry') 92 ->method('importEntry')
93 ->willReturn($entry); 93 ->willReturn($entry);
94 94
95 $res = $readabilityImport->import(); 95 $res = $readabilityImport->import();
@@ -118,7 +118,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
118 118
119 $this->contentProxy 119 $this->contentProxy
120 ->expects($this->exactly(1)) 120 ->expects($this->exactly(1))
121 ->method('updateEntry') 121 ->method('importEntry')
122 ->willReturn(new Entry($this->user)); 122 ->willReturn(new Entry($this->user));
123 123
124 // check that every entry persisted are archived 124 // check that every entry persisted are archived
@@ -158,7 +158,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
158 158
159 $this->contentProxy 159 $this->contentProxy
160 ->expects($this->never()) 160 ->expects($this->never())
161 ->method('updateEntry'); 161 ->method('importEntry');
162 162
163 $producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer') 163 $producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
164 ->disableOriginalConstructor() 164 ->disableOriginalConstructor()
@@ -198,7 +198,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
198 198
199 $this->contentProxy 199 $this->contentProxy
200 ->expects($this->never()) 200 ->expects($this->never())
201 ->method('updateEntry'); 201 ->method('importEntry');
202 202
203 $factory = new RedisMockFactory(); 203 $factory = new RedisMockFactory();
204 $redisMock = $factory->getAdapter('Predis\Client', true); 204 $redisMock = $factory->getAdapter('Predis\Client', true);
diff --git a/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php b/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php
index 7cbef637..f23cb748 100644
--- a/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php
@@ -104,7 +104,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
104 104
105 $this->contentProxy 105 $this->contentProxy
106 ->expects($this->exactly(1)) 106 ->expects($this->exactly(1))
107 ->method('updateEntry') 107 ->method('importEntry')
108 ->willReturn($entry); 108 ->willReturn($entry);
109 109
110 $res = $wallabagV1Import->import(); 110 $res = $wallabagV1Import->import();
@@ -133,7 +133,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
133 133
134 $this->contentProxy 134 $this->contentProxy
135 ->expects($this->exactly(3)) 135 ->expects($this->exactly(3))
136 ->method('updateEntry') 136 ->method('importEntry')
137 ->willReturn(new Entry($this->user)); 137 ->willReturn(new Entry($this->user));
138 138
139 // check that every entry persisted are archived 139 // check that every entry persisted are archived
@@ -173,7 +173,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
173 173
174 $this->contentProxy 174 $this->contentProxy
175 ->expects($this->never()) 175 ->expects($this->never())
176 ->method('updateEntry'); 176 ->method('importEntry');
177 177
178 $producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer') 178 $producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
179 ->disableOriginalConstructor() 179 ->disableOriginalConstructor()
@@ -213,7 +213,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
213 213
214 $this->contentProxy 214 $this->contentProxy
215 ->expects($this->never()) 215 ->expects($this->never())
216 ->method('updateEntry'); 216 ->method('importEntry');
217 217
218 $factory = new RedisMockFactory(); 218 $factory = new RedisMockFactory();
219 $redisMock = $factory->getAdapter('Predis\Client', true); 219 $redisMock = $factory->getAdapter('Predis\Client', true);
diff --git a/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php b/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php
index 5cc04aa5..e1acf569 100644
--- a/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php
@@ -100,7 +100,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
100 100
101 $this->contentProxy 101 $this->contentProxy
102 ->expects($this->exactly(2)) 102 ->expects($this->exactly(2))
103 ->method('updateEntry') 103 ->method('importEntry')
104 ->willReturn(new Entry($this->user)); 104 ->willReturn(new Entry($this->user));
105 105
106 $res = $wallabagV2Import->import(); 106 $res = $wallabagV2Import->import();
@@ -129,7 +129,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
129 129
130 $this->contentProxy 130 $this->contentProxy
131 ->expects($this->exactly(2)) 131 ->expects($this->exactly(2))
132 ->method('updateEntry') 132 ->method('importEntry')
133 ->willReturn(new Entry($this->user)); 133 ->willReturn(new Entry($this->user));
134 134
135 // check that every entry persisted are archived 135 // check that every entry persisted are archived
@@ -165,7 +165,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
165 165
166 $this->contentProxy 166 $this->contentProxy
167 ->expects($this->never()) 167 ->expects($this->never())
168 ->method('updateEntry'); 168 ->method('importEntry');
169 169
170 $producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer') 170 $producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
171 ->disableOriginalConstructor() 171 ->disableOriginalConstructor()
@@ -201,7 +201,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
201 201
202 $this->contentProxy 202 $this->contentProxy
203 ->expects($this->never()) 203 ->expects($this->never())
204 ->method('updateEntry'); 204 ->method('importEntry');
205 205
206 $factory = new RedisMockFactory(); 206 $factory = new RedisMockFactory();
207 $redisMock = $factory->getAdapter('Predis\Client', true); 207 $redisMock = $factory->getAdapter('Predis\Client', true);
@@ -278,7 +278,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
278 278
279 $this->contentProxy 279 $this->contentProxy
280 ->expects($this->exactly(2)) 280 ->expects($this->exactly(2))
281 ->method('updateEntry') 281 ->method('importEntry')
282 ->will($this->throwException(new \Exception())); 282 ->will($this->throwException(new \Exception()));
283 283
284 $res = $wallabagV2Import->import(); 284 $res = $wallabagV2Import->import();