aboutsummaryrefslogtreecommitdiffhomepage
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
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.
-rw-r--r--src/Wallabag/CoreBundle/Helper/ContentProxy.php76
-rw-r--r--src/Wallabag/ImportBundle/Command/ImportCommand.php4
-rw-r--r--src/Wallabag/ImportBundle/Import/AbstractImport.php29
-rw-r--r--tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php9
-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
11 files changed, 118 insertions, 60 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php
index c73b8eaf..88873bd5 100644
--- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php
+++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php
@@ -7,6 +7,7 @@ use Psr\Log\LoggerInterface;
7use Wallabag\CoreBundle\Entity\Entry; 7use Wallabag\CoreBundle\Entity\Entry;
8use Wallabag\CoreBundle\Tools\Utils; 8use Wallabag\CoreBundle\Tools\Utils;
9use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeExtensionGuesser; 9use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeExtensionGuesser;
10use Symfony\Component\Config\Definition\Exception\Exception;
10 11
11/** 12/**
12 * This kind of proxy class take care of getting the content from an url 13 * This kind of proxy class take care of getting the content from an url
@@ -31,34 +32,58 @@ class ContentProxy
31 } 32 }
32 33
33 /** 34 /**
34 * Fetch content using graby and hydrate given $entry with results information. 35 * Update existing entry by fetching from URL using Graby.
35 * In case we couldn't find content, we'll try to use Open Graph data.
36 *
37 * We can also force the content, in case of an import from the v1 for example, so the function won't
38 * fetch the content from the website but rather use information given with the $content parameter.
39 * 36 *
40 * @param Entry $entry Entry to update 37 * @param Entry $entry Entry to update
41 * @param string $url Url to grab content for 38 * @param string $url Url to grab content for
42 * @param array $content An array with AT LEAST keys title, html, url to skip the fetchContent from the url
43 */ 39 */
44 public function updateEntry(Entry $entry, $url, array $content = []) 40 public function updateEntry(Entry $entry, $url)
45 { 41 {
46 // ensure content is a bit cleaned up 42 $content = $this->graby->fetchContent($url);
47 if (!empty($content['html'])) { 43
48 $content['html'] = $this->graby->cleanupHtml($content['html'], $url); 44 $this->stockEntry($entry, $content);
49 } 45 }
46
47 /**
48 * Import entry using either fetched or provided content.
49 *
50 * @param Entry $entry Entry to update
51 * @param array $content Array with content provided for import with AT LEAST keys title, html, url to skip the fetchContent from the url
52 * @param bool $disableContentUpdate Whether to skip trying to fetch content using Graby
53 */
54 public function importEntry(Entry $entry, array $content, $disableContentUpdate = false)
55 {
56 $this->validateContent($content);
50 57
51 // do we have to fetch the content or the provided one is ok? 58 if (false === $disableContentUpdate) {
52 if (empty($content) || false === $this->validateContent($content)) { 59 try {
53 $fetchedContent = $this->graby->fetchContent($url); 60 $fetchedContent = $this->graby->fetchContent($content['url']);
61 } catch (\Exception $e) {
62 $this->logger->error('Error while trying to fetch content from URL.', [
63 'entry_url' => $content['url'],
64 'error_msg' => $e->getMessage(),
65 ]);
66 }
54 67
55 // when content is imported, we have information in $content 68 // when content is imported, we have information in $content
56 // in case fetching content goes bad, we'll keep the imported information instead of overriding them 69 // in case fetching content goes bad, we'll keep the imported information instead of overriding them
57 if (empty($content) || $fetchedContent['html'] !== $this->fetchingErrorMessage) { 70 if ($fetchedContent['html'] !== $this->fetchingErrorMessage) {
58 $content = $fetchedContent; 71 $content = $fetchedContent;
59 } 72 }
60 } 73 }
61 74
75 $this->stockEntry($entry, $content);
76 }
77
78 /**
79 * Stock entry with fetched or imported content.
80 * Will fall back to OpenGraph data if available.
81 *
82 * @param Entry $entry Entry to stock
83 * @param array $content Array with at least title and URL
84 */
85 private function stockEntry(Entry $entry, array $content)
86 {
62 $title = $content['title']; 87 $title = $content['title'];
63 if (!$title && !empty($content['open_graph']['og_title'])) { 88 if (!$title && !empty($content['open_graph']['og_title'])) {
64 $title = $content['open_graph']['og_title']; 89 $title = $content['open_graph']['og_title'];
@@ -74,7 +99,7 @@ class ContentProxy
74 } 99 }
75 } 100 }
76 101
77 $entry->setUrl($content['url'] ?: $url); 102 $entry->setUrl($content['url']);
78 $entry->setTitle($title); 103 $entry->setTitle($title);
79 $entry->setContent($html); 104 $entry->setContent($html);
80 $entry->setHttpStatus(isset($content['status']) ? $content['status'] : ''); 105 $entry->setHttpStatus(isset($content['status']) ? $content['status'] : '');
@@ -124,22 +149,29 @@ class ContentProxy
124 $this->tagger->tag($entry); 149 $this->tagger->tag($entry);
125 } catch (\Exception $e) { 150 } catch (\Exception $e) {
126 $this->logger->error('Error while trying to automatically tag an entry.', [ 151 $this->logger->error('Error while trying to automatically tag an entry.', [
127 'entry_url' => $url, 152 'entry_url' => $content['url'],
128 'error_msg' => $e->getMessage(), 153 'error_msg' => $e->getMessage(),
129 ]); 154 ]);
130 } 155 }
131 } 156 }
132 157
133 /** 158 /**
134 * Validate that the given content as enough value to be used 159 * Validate that the given content has at least a title, an html and a url.
135 * instead of fetch the content from the url.
136 * 160 *
137 * @param array $content 161 * @param array $content
138 *
139 * @return bool true if valid otherwise false
140 */ 162 */
141 private function validateContent(array $content) 163 private function validateContent(array $content)
142 { 164 {
143 return !empty($content['title']) && !empty($content['html']) && !empty($content['url']); 165 if (!empty($content['title']))) {
166 throw new Exception('Missing title from imported entry!');
167 }
168
169 if (!empty($content['url']))) {
170 throw new Exception('Missing URL from imported entry!');
171 }
172
173 if (!empty($content['html']))) {
174 throw new Exception('Missing html from imported entry!');
175 }
144 } 176 }
145} 177}
diff --git a/src/Wallabag/ImportBundle/Command/ImportCommand.php b/src/Wallabag/ImportBundle/Command/ImportCommand.php
index ce72837a..bca800e6 100644
--- a/src/Wallabag/ImportBundle/Command/ImportCommand.php
+++ b/src/Wallabag/ImportBundle/Command/ImportCommand.php
@@ -5,6 +5,7 @@ namespace Wallabag\ImportBundle\Command;
5use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; 5use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6use Symfony\Component\Config\Definition\Exception\Exception; 6use Symfony\Component\Config\Definition\Exception\Exception;
7use Symfony\Component\Console\Input\InputArgument; 7use Symfony\Component\Console\Input\InputArgument;
8use Symfony\Component\Console\Input\InputOption;
8use Symfony\Component\Console\Input\InputInterface; 9use Symfony\Component\Console\Input\InputInterface;
9use Symfony\Component\Console\Output\OutputInterface; 10use Symfony\Component\Console\Output\OutputInterface;
10 11
@@ -19,7 +20,7 @@ class ImportCommand extends ContainerAwareCommand
19 ->addArgument('filepath', InputArgument::REQUIRED, 'Path to the JSON file') 20 ->addArgument('filepath', InputArgument::REQUIRED, 'Path to the JSON file')
20 ->addOption('importer', null, InputArgument::OPTIONAL, 'The importer to use: v1, v2, instapaper, pinboard, readability, firefox or chrome', 'v1') 21 ->addOption('importer', null, InputArgument::OPTIONAL, 'The importer to use: v1, v2, instapaper, pinboard, readability, firefox or chrome', 'v1')
21 ->addOption('markAsRead', null, InputArgument::OPTIONAL, 'Mark all entries as read', false) 22 ->addOption('markAsRead', null, InputArgument::OPTIONAL, 'Mark all entries as read', false)
22 ->addOption('useUserId', null, InputArgument::OPTIONAL, 'Use user id instead of username to find account', false) 23 ->addOption('disableContentUpdate', null, InputOption::VALUE_NONE, 'Disable fetching updated content from URL')
23 ; 24 ;
24 } 25 }
25 26
@@ -69,6 +70,7 @@ class ImportCommand extends ContainerAwareCommand
69 } 70 }
70 71
71 $import->setMarkAsRead($input->getOption('markAsRead')); 72 $import->setMarkAsRead($input->getOption('markAsRead'));
73 $import->setDisableContentUpdate($input->getOption('disableContentUpdate'));
72 $import->setUser($user); 74 $import->setUser($user);
73 75
74 $res = $import 76 $res = $import
diff --git a/src/Wallabag/ImportBundle/Import/AbstractImport.php b/src/Wallabag/ImportBundle/Import/AbstractImport.php
index fc462c4c..167853aa 100644
--- a/src/Wallabag/ImportBundle/Import/AbstractImport.php
+++ b/src/Wallabag/ImportBundle/Import/AbstractImport.php
@@ -24,6 +24,7 @@ abstract class AbstractImport implements ImportInterface
24 protected $producer; 24 protected $producer;
25 protected $user; 25 protected $user;
26 protected $markAsRead; 26 protected $markAsRead;
27 protected $disableContentUpdate;
27 protected $skippedEntries = 0; 28 protected $skippedEntries = 0;
28 protected $importedEntries = 0; 29 protected $importedEntries = 0;
29 protected $queuedEntries = 0; 30 protected $queuedEntries = 0;
@@ -85,6 +86,27 @@ abstract class AbstractImport implements ImportInterface
85 } 86 }
86 87
87 /** 88 /**
89 * Set whether articles should be fetched for updated content.
90 *
91 * @param bool $markAsRead
92 */
93 public function setDisableContentUpdate($disableContentUpdate)
94 {
95 $this->disableContentUpdate = $disableContentUpdate;
96
97 return $this;
98 }
99
100 /**
101 * Get whether articles should be fetched for updated content.
102 */
103 public function getDisableContentUpdate()
104 {
105 return $this->disableContentUpdate;
106 }
107
108
109 /**
88 * Fetch content from the ContentProxy (using graby). 110 * Fetch content from the ContentProxy (using graby).
89 * If it fails return the given entry to be saved in all case (to avoid user to loose the content). 111 * If it fails return the given entry to be saved in all case (to avoid user to loose the content).
90 * 112 *
@@ -95,9 +117,12 @@ abstract class AbstractImport implements ImportInterface
95 protected function fetchContent(Entry $entry, $url, array $content = []) 117 protected function fetchContent(Entry $entry, $url, array $content = [])
96 { 118 {
97 try { 119 try {
98 $this->contentProxy->updateEntry($entry, $url, $content); 120 $this->contentProxy->importEntry($entry, $content, $this->disableContentUpdate);
99 } catch (\Exception $e) { 121 } catch (\Exception $e) {
100 return $entry; 122 $this->logger->error('Error trying to import an entry.', [
123 'entry_url' => $content['url'],
124 'error_msg' => $e->getMessage(),
125 ]);
101 } 126 }
102 } 127 }
103 128
diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
index 16643938..1ad21d14 100644
--- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
@@ -257,9 +257,8 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
257 257
258 $proxy = new ContentProxy((new Graby()), $tagger, $this->getLogger(), $this->fetchingErrorMessage); 258 $proxy = new ContentProxy((new Graby()), $tagger, $this->getLogger(), $this->fetchingErrorMessage);
259 $entry = new Entry(new User()); 259 $entry = new Entry(new User());
260 $proxy->updateEntry( 260 $proxy->importEntry(
261 $entry, 261 $entry,
262 'http://0.0.0.0',
263 [ 262 [
264 'html' => str_repeat('this is my content', 325), 263 'html' => str_repeat('this is my content', 325),
265 'title' => 'this is my title', 264 'title' => 'this is my title',
@@ -294,7 +293,6 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
294 $entry = new Entry(new User()); 293 $entry = new Entry(new User());
295 $proxy->updateEntry( 294 $proxy->updateEntry(
296 $entry, 295 $entry,
297 'http://0.0.0.0',
298 [ 296 [
299 'html' => str_repeat('this is my content', 325), 297 'html' => str_repeat('this is my content', 325),
300 'title' => 'this is my title', 298 'title' => 'this is my title',
@@ -334,13 +332,14 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
334 $proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage); 332 $proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage);
335 333
336 $entry = new Entry(new User()); 334 $entry = new Entry(new User());
337 $proxy->updateEntry($entry, 'http://0.0.0.0', [ 335 $content = array(
338 'html' => str_repeat('this is my content', 325), 336 'html' => str_repeat('this is my content', 325),
339 'title' => 'this is my title', 337 'title' => 'this is my title',
340 'url' => 'http://1.1.1.1', 338 'url' => 'http://1.1.1.1',
341 'content_type' => 'text/html', 339 'content_type' => 'text/html',
342 'language' => 'fr', 340 'language' => 'fr',
343 ]); 341 );
342 $proxy->importEntry($entry, $content, true);
344 343
345 $this->assertCount(0, $entry->getTags()); 344 $this->assertCount(0, $entry->getTags());
346 } 345 }
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();