diff options
10 files changed, 40 insertions, 35 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index fd059325..0130bd2b 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php | |||
@@ -21,14 +21,16 @@ class ContentProxy | |||
21 | protected $logger; | 21 | protected $logger; |
22 | protected $tagRepository; | 22 | protected $tagRepository; |
23 | protected $mimeGuesser; | 23 | protected $mimeGuesser; |
24 | protected $fetchingErrorMessage; | ||
24 | 25 | ||
25 | public function __construct(Graby $graby, RuleBasedTagger $tagger, TagRepository $tagRepository, LoggerInterface $logger) | 26 | public function __construct(Graby $graby, RuleBasedTagger $tagger, TagRepository $tagRepository, LoggerInterface $logger, $fetchingErrorMessage) |
26 | { | 27 | { |
27 | $this->graby = $graby; | 28 | $this->graby = $graby; |
28 | $this->tagger = $tagger; | 29 | $this->tagger = $tagger; |
29 | $this->logger = $logger; | 30 | $this->logger = $logger; |
30 | $this->tagRepository = $tagRepository; | 31 | $this->tagRepository = $tagRepository; |
31 | $this->mimeGuesser = new MimeTypeExtensionGuesser(); | 32 | $this->mimeGuesser = new MimeTypeExtensionGuesser(); |
33 | $this->fetchingErrorMessage = $fetchingErrorMessage; | ||
32 | } | 34 | } |
33 | 35 | ||
34 | /** | 36 | /** |
@@ -48,7 +50,13 @@ class ContentProxy | |||
48 | { | 50 | { |
49 | // do we have to fetch the content or the provided one is ok? | 51 | // do we have to fetch the content or the provided one is ok? |
50 | if (empty($content) || false === $this->validateContent($content)) { | 52 | if (empty($content) || false === $this->validateContent($content)) { |
51 | $content = $this->graby->fetchContent($url); | 53 | $fetchedContent = $this->graby->fetchContent($url); |
54 | |||
55 | // 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 | ||
57 | if (empty($content) || $fetchedContent['html'] !== $this->fetchingErrorMessage) { | ||
58 | $content = $fetchedContent; | ||
59 | } | ||
52 | } | 60 | } |
53 | 61 | ||
54 | $title = $content['title']; | 62 | $title = $content['title']; |
@@ -58,7 +66,7 @@ class ContentProxy | |||
58 | 66 | ||
59 | $html = $content['html']; | 67 | $html = $content['html']; |
60 | if (false === $html) { | 68 | if (false === $html) { |
61 | $html = '<p>Unable to retrieve readable content.</p>'; | 69 | $html = $this->fetchingErrorMessage; |
62 | 70 | ||
63 | if (isset($content['open_graph']['og_description'])) { | 71 | if (isset($content['open_graph']['og_description'])) { |
64 | $html .= '<p><i>But we found a short description: </i></p>'; | 72 | $html .= '<p><i>But we found a short description: </i></p>'; |
@@ -71,8 +79,8 @@ class ContentProxy | |||
71 | $entry->setContent($html); | 79 | $entry->setContent($html); |
72 | $entry->setHttpStatus(isset($content['status']) ? $content['status'] : ''); | 80 | $entry->setHttpStatus(isset($content['status']) ? $content['status'] : ''); |
73 | 81 | ||
74 | $entry->setLanguage($content['language']); | 82 | $entry->setLanguage(isset($content['language']) ? $content['language'] : ''); |
75 | $entry->setMimetype($content['content_type']); | 83 | $entry->setMimetype(isset($content['content_type']) ? $content['content_type'] : ''); |
76 | $entry->setReadingTime(Utils::getReadingTime($html)); | 84 | $entry->setReadingTime(Utils::getReadingTime($html)); |
77 | 85 | ||
78 | $domainName = parse_url($entry->getUrl(), PHP_URL_HOST); | 86 | $domainName = parse_url($entry->getUrl(), PHP_URL_HOST); |
@@ -85,7 +93,7 @@ class ContentProxy | |||
85 | } | 93 | } |
86 | 94 | ||
87 | // if content is an image define as a preview too | 95 | // if content is an image define as a preview too |
88 | if (in_array($this->mimeGuesser->guess($content['content_type']), ['jpeg', 'jpg', 'gif', 'png'], true)) { | 96 | if (isset($content['content_type']) && in_array($this->mimeGuesser->guess($content['content_type']), ['jpeg', 'jpg', 'gif', 'png'], true)) { |
89 | $entry->setPreviewPicture($content['url']); | 97 | $entry->setPreviewPicture($content['url']); |
90 | } | 98 | } |
91 | 99 | ||
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index bcf0c9ca..fadd5e49 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml | |||
@@ -86,6 +86,7 @@ services: | |||
86 | - "@wallabag_core.rule_based_tagger" | 86 | - "@wallabag_core.rule_based_tagger" |
87 | - "@wallabag_core.tag_repository" | 87 | - "@wallabag_core.tag_repository" |
88 | - "@logger" | 88 | - "@logger" |
89 | - '%wallabag_core.fetching_error_message%' | ||
89 | 90 | ||
90 | wallabag_core.rule_based_tagger: | 91 | wallabag_core.rule_based_tagger: |
91 | class: Wallabag\CoreBundle\Helper\RuleBasedTagger | 92 | class: Wallabag\CoreBundle\Helper\RuleBasedTagger |
diff --git a/src/Wallabag/ImportBundle/Import/ChromeImport.php b/src/Wallabag/ImportBundle/Import/ChromeImport.php index d7620bcb..1a324934 100644 --- a/src/Wallabag/ImportBundle/Import/ChromeImport.php +++ b/src/Wallabag/ImportBundle/Import/ChromeImport.php | |||
@@ -37,7 +37,7 @@ class ChromeImport extends BrowserImport | |||
37 | { | 37 | { |
38 | $data = [ | 38 | $data = [ |
39 | 'title' => $entry['name'], | 39 | 'title' => $entry['name'], |
40 | 'html' => '', | 40 | 'html' => false, |
41 | 'url' => $entry['url'], | 41 | 'url' => $entry['url'], |
42 | 'is_archived' => $this->markAsRead, | 42 | 'is_archived' => $this->markAsRead, |
43 | 'tags' => '', | 43 | 'tags' => '', |
diff --git a/src/Wallabag/ImportBundle/Import/FirefoxImport.php b/src/Wallabag/ImportBundle/Import/FirefoxImport.php index e010f5a4..d3f99770 100644 --- a/src/Wallabag/ImportBundle/Import/FirefoxImport.php +++ b/src/Wallabag/ImportBundle/Import/FirefoxImport.php | |||
@@ -37,7 +37,7 @@ class FirefoxImport extends BrowserImport | |||
37 | { | 37 | { |
38 | $data = [ | 38 | $data = [ |
39 | 'title' => $entry['title'], | 39 | 'title' => $entry['title'], |
40 | 'html' => '', | 40 | 'html' => false, |
41 | 'url' => $entry['uri'], | 41 | 'url' => $entry['uri'], |
42 | 'is_archived' => $this->markAsRead, | 42 | 'is_archived' => $this->markAsRead, |
43 | 'tags' => '', | 43 | 'tags' => '', |
diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php index cf4c785c..70a53f1a 100644 --- a/src/Wallabag/ImportBundle/Import/InstapaperImport.php +++ b/src/Wallabag/ImportBundle/Import/InstapaperImport.php | |||
@@ -74,8 +74,7 @@ class InstapaperImport extends AbstractImport | |||
74 | 'status' => $data[3], | 74 | 'status' => $data[3], |
75 | 'is_archived' => $data[3] === 'Archive' || $data[3] === 'Starred', | 75 | 'is_archived' => $data[3] === 'Archive' || $data[3] === 'Starred', |
76 | 'is_starred' => $data[3] === 'Starred', | 76 | 'is_starred' => $data[3] === 'Starred', |
77 | 'content_type' => '', | 77 | 'html' => false, |
78 | 'language' => '', | ||
79 | ]; | 78 | ]; |
80 | } | 79 | } |
81 | fclose($handle); | 80 | fclose($handle); |
diff --git a/src/Wallabag/ImportBundle/Import/PinboardImport.php b/src/Wallabag/ImportBundle/Import/PinboardImport.php index 9bcfbc36..d9865534 100644 --- a/src/Wallabag/ImportBundle/Import/PinboardImport.php +++ b/src/Wallabag/ImportBundle/Import/PinboardImport.php | |||
@@ -98,8 +98,6 @@ class PinboardImport extends AbstractImport | |||
98 | $data = [ | 98 | $data = [ |
99 | 'title' => $importedEntry['description'], | 99 | 'title' => $importedEntry['description'], |
100 | 'url' => $importedEntry['href'], | 100 | 'url' => $importedEntry['href'], |
101 | 'content_type' => '', | ||
102 | 'language' => '', | ||
103 | 'is_archived' => ('no' === $importedEntry['toread']) || $this->markAsRead, | 101 | 'is_archived' => ('no' === $importedEntry['toread']) || $this->markAsRead, |
104 | 'is_starred' => false, | 102 | 'is_starred' => false, |
105 | 'created_at' => $importedEntry['time'], | 103 | 'created_at' => $importedEntry['time'], |
diff --git a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php index b8c0f777..de320d23 100644 --- a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php +++ b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php | |||
@@ -98,11 +98,10 @@ class ReadabilityImport extends AbstractImport | |||
98 | $data = [ | 98 | $data = [ |
99 | 'title' => $importedEntry['article__title'], | 99 | 'title' => $importedEntry['article__title'], |
100 | 'url' => $importedEntry['article__url'], | 100 | 'url' => $importedEntry['article__url'], |
101 | 'content_type' => '', | ||
102 | 'language' => '', | ||
103 | 'is_archived' => $importedEntry['archive'] || $this->markAsRead, | 101 | 'is_archived' => $importedEntry['archive'] || $this->markAsRead, |
104 | 'is_starred' => $importedEntry['favorite'], | 102 | 'is_starred' => $importedEntry['favorite'], |
105 | 'created_at' => $importedEntry['date_added'], | 103 | 'created_at' => $importedEntry['date_added'], |
104 | 'html' => false, | ||
106 | ]; | 105 | ]; |
107 | 106 | ||
108 | $entry = new Entry($this->user); | 107 | $entry = new Entry($this->user); |
diff --git a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php index 4f001062..59e3ce02 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php +++ b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php | |||
@@ -37,8 +37,6 @@ class WallabagV1Import extends WallabagImport | |||
37 | 'title' => $entry['title'], | 37 | 'title' => $entry['title'], |
38 | 'html' => $entry['content'], | 38 | 'html' => $entry['content'], |
39 | 'url' => $entry['url'], | 39 | 'url' => $entry['url'], |
40 | 'content_type' => '', | ||
41 | 'language' => '', | ||
42 | 'is_archived' => $entry['is_read'] || $this->markAsRead, | 40 | 'is_archived' => $entry['is_read'] || $this->markAsRead, |
43 | 'is_starred' => $entry['is_fav'], | 41 | 'is_starred' => $entry['is_fav'], |
44 | 'tags' => '', | 42 | 'tags' => '', |
diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php index 33b3ff2a..2ca13b91 100644 --- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php +++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php | |||
@@ -10,6 +10,8 @@ use Wallabag\UserBundle\Entity\User; | |||
10 | 10 | ||
11 | class ContentProxyTest extends \PHPUnit_Framework_TestCase | 11 | class ContentProxyTest extends \PHPUnit_Framework_TestCase |
12 | { | 12 | { |
13 | private $fetchingErrorMessage = 'wallabag can\'t retrieve contents for this article. Please <a href="http://doc.wallabag.org/en/master/user/errors_during_fetching.html#how-can-i-help-to-fix-that">troubleshoot this issue</a>.'; | ||
14 | |||
13 | public function testWithBadUrl() | 15 | public function testWithBadUrl() |
14 | { | 16 | { |
15 | $tagger = $this->getTaggerMock(); | 17 | $tagger = $this->getTaggerMock(); |
@@ -31,12 +33,12 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
31 | 'language' => '', | 33 | 'language' => '', |
32 | ]); | 34 | ]); |
33 | 35 | ||
34 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); | 36 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage); |
35 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://user@:80'); | 37 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://user@:80'); |
36 | 38 | ||
37 | $this->assertEquals('http://user@:80', $entry->getUrl()); | 39 | $this->assertEquals('http://user@:80', $entry->getUrl()); |
38 | $this->assertEmpty($entry->getTitle()); | 40 | $this->assertEmpty($entry->getTitle()); |
39 | $this->assertEquals('<p>Unable to retrieve readable content.</p>', $entry->getContent()); | 41 | $this->assertEquals($this->fetchingErrorMessage, $entry->getContent()); |
40 | $this->assertEmpty($entry->getPreviewPicture()); | 42 | $this->assertEmpty($entry->getPreviewPicture()); |
41 | $this->assertEmpty($entry->getMimetype()); | 43 | $this->assertEmpty($entry->getMimetype()); |
42 | $this->assertEmpty($entry->getLanguage()); | 44 | $this->assertEmpty($entry->getLanguage()); |
@@ -65,12 +67,12 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
65 | 'language' => '', | 67 | 'language' => '', |
66 | ]); | 68 | ]); |
67 | 69 | ||
68 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); | 70 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage); |
69 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); | 71 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); |
70 | 72 | ||
71 | $this->assertEquals('http://0.0.0.0', $entry->getUrl()); | 73 | $this->assertEquals('http://0.0.0.0', $entry->getUrl()); |
72 | $this->assertEmpty($entry->getTitle()); | 74 | $this->assertEmpty($entry->getTitle()); |
73 | $this->assertEquals('<p>Unable to retrieve readable content.</p>', $entry->getContent()); | 75 | $this->assertEquals($this->fetchingErrorMessage, $entry->getContent()); |
74 | $this->assertEmpty($entry->getPreviewPicture()); | 76 | $this->assertEmpty($entry->getPreviewPicture()); |
75 | $this->assertEmpty($entry->getMimetype()); | 77 | $this->assertEmpty($entry->getMimetype()); |
76 | $this->assertEmpty($entry->getLanguage()); | 78 | $this->assertEmpty($entry->getLanguage()); |
@@ -104,12 +106,12 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
104 | ], | 106 | ], |
105 | ]); | 107 | ]); |
106 | 108 | ||
107 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); | 109 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage); |
108 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://domain.io'); | 110 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://domain.io'); |
109 | 111 | ||
110 | $this->assertEquals('http://domain.io', $entry->getUrl()); | 112 | $this->assertEquals('http://domain.io', $entry->getUrl()); |
111 | $this->assertEquals('my title', $entry->getTitle()); | 113 | $this->assertEquals('my title', $entry->getTitle()); |
112 | $this->assertEquals('<p>Unable to retrieve readable content.</p><p><i>But we found a short description: </i></p>desc', $entry->getContent()); | 114 | $this->assertEquals($this->fetchingErrorMessage . '<p><i>But we found a short description: </i></p>desc', $entry->getContent()); |
113 | $this->assertEmpty($entry->getPreviewPicture()); | 115 | $this->assertEmpty($entry->getPreviewPicture()); |
114 | $this->assertEmpty($entry->getLanguage()); | 116 | $this->assertEmpty($entry->getLanguage()); |
115 | $this->assertEmpty($entry->getHttpStatus()); | 117 | $this->assertEmpty($entry->getHttpStatus()); |
@@ -145,7 +147,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
145 | ], | 147 | ], |
146 | ]); | 148 | ]); |
147 | 149 | ||
148 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); | 150 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage); |
149 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); | 151 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); |
150 | 152 | ||
151 | $this->assertEquals('http://1.1.1.1', $entry->getUrl()); | 153 | $this->assertEquals('http://1.1.1.1', $entry->getUrl()); |
@@ -167,7 +169,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
167 | 169 | ||
168 | $graby = $this->getMockBuilder('Graby\Graby')->getMock(); | 170 | $graby = $this->getMockBuilder('Graby\Graby')->getMock(); |
169 | 171 | ||
170 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); | 172 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage); |
171 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0', [ | 173 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0', [ |
172 | 'html' => str_repeat('this is my content', 325), | 174 | 'html' => str_repeat('this is my content', 325), |
173 | 'title' => 'this is my title', | 175 | 'title' => 'this is my title', |
@@ -197,7 +199,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
197 | ->will($this->throwException(new \Exception())); | 199 | ->will($this->throwException(new \Exception())); |
198 | 200 | ||
199 | $tagRepo = $this->getTagRepositoryMock(); | 201 | $tagRepo = $this->getTagRepositoryMock(); |
200 | $proxy = new ContentProxy($graby, $tagger, $tagRepo, $this->getLogger()); | 202 | $proxy = new ContentProxy($graby, $tagger, $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); |
201 | 203 | ||
202 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0', [ | 204 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0', [ |
203 | 'html' => str_repeat('this is my content', 325), | 205 | 'html' => str_repeat('this is my content', 325), |
@@ -217,7 +219,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
217 | ->getMock(); | 219 | ->getMock(); |
218 | 220 | ||
219 | $tagRepo = $this->getTagRepositoryMock(); | 221 | $tagRepo = $this->getTagRepositoryMock(); |
220 | $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger()); | 222 | $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); |
221 | 223 | ||
222 | $entry = new Entry(new User()); | 224 | $entry = new Entry(new User()); |
223 | 225 | ||
@@ -235,7 +237,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
235 | ->getMock(); | 237 | ->getMock(); |
236 | 238 | ||
237 | $tagRepo = $this->getTagRepositoryMock(); | 239 | $tagRepo = $this->getTagRepositoryMock(); |
238 | $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger()); | 240 | $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); |
239 | 241 | ||
240 | $entry = new Entry(new User()); | 242 | $entry = new Entry(new User()); |
241 | 243 | ||
@@ -253,7 +255,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
253 | ->getMock(); | 255 | ->getMock(); |
254 | 256 | ||
255 | $tagRepo = $this->getTagRepositoryMock(); | 257 | $tagRepo = $this->getTagRepositoryMock(); |
256 | $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger()); | 258 | $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); |
257 | 259 | ||
258 | $entry = new Entry(new User()); | 260 | $entry = new Entry(new User()); |
259 | 261 | ||
@@ -269,7 +271,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
269 | ->getMock(); | 271 | ->getMock(); |
270 | 272 | ||
271 | $tagRepo = $this->getTagRepositoryMock(); | 273 | $tagRepo = $this->getTagRepositoryMock(); |
272 | $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger()); | 274 | $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); |
273 | 275 | ||
274 | $entry = new Entry(new User()); | 276 | $entry = new Entry(new User()); |
275 | 277 | ||
@@ -285,7 +287,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
285 | ->getMock(); | 287 | ->getMock(); |
286 | 288 | ||
287 | $tagRepo = $this->getTagRepositoryMock(); | 289 | $tagRepo = $this->getTagRepositoryMock(); |
288 | $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger()); | 290 | $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); |
289 | 291 | ||
290 | $tagEntity = new Tag(); | 292 | $tagEntity = new Tag(); |
291 | $tagEntity->setLabel('tag1'); | 293 | $tagEntity->setLabel('tag1'); |
@@ -310,7 +312,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
310 | $tagRepo->expects($this->never()) | 312 | $tagRepo->expects($this->never()) |
311 | ->method('__call'); | 313 | ->method('__call'); |
312 | 314 | ||
313 | $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger()); | 315 | $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); |
314 | 316 | ||
315 | $tagEntity = new Tag(); | 317 | $tagEntity = new Tag(); |
316 | $tagEntity->setLabel('tag1'); | 318 | $tagEntity->setLabel('tag1'); |
diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php index 2c370ed9..acc39997 100644 --- a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php | |||
@@ -112,7 +112,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase | |||
112 | ->get('doctrine.orm.entity_manager') | 112 | ->get('doctrine.orm.entity_manager') |
113 | ->getRepository('WallabagCoreBundle:Entry') | 113 | ->getRepository('WallabagCoreBundle:Entry') |
114 | ->findByUrlAndUserId( | 114 | ->findByUrlAndUserId( |
115 | 'http://www.framablog.org/index.php/post/2014/02/05/Framabag-service-libre-gratuit-interview-developpeur', | 115 | 'https://framablog.org/2014/02/05/framabag-service-libre-gratuit-interview-developpeur/', |
116 | $this->getLoggedInUserId() | 116 | $this->getLoggedInUserId() |
117 | ); | 117 | ); |
118 | 118 | ||
@@ -126,9 +126,9 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase | |||
126 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); | 126 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); |
127 | $this->assertContains('flashes.import.notice.summary', $body[0]); | 127 | $this->assertContains('flashes.import.notice.summary', $body[0]); |
128 | 128 | ||
129 | $this->assertEmpty($content->getMimetype(), 'Mimetype for http://www.framablog.org is ok'); | 129 | $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.framablog.org is ok'); |
130 | $this->assertEmpty($content->getPreviewPicture(), 'Preview picture for http://www.framablog.org is ok'); | 130 | $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.framablog.org is ok'); |
131 | $this->assertEmpty($content->getLanguage(), 'Language for http://www.framablog.org is ok'); | 131 | $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.framablog.org is ok'); |
132 | $this->assertEquals(1, count($content->getTags())); | 132 | $this->assertEquals(1, count($content->getTags())); |
133 | $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); | 133 | $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); |
134 | } | 134 | } |