aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2019-05-28 12:02:17 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2019-05-28 12:02:17 +0200
commit6e68417f0356d0045d7a2aa3832507d362ddcfe8 (patch)
tree308e15326adc658702f257693338f101d36e1af8
parent36b0d52ee4a0ca76049952100eaf393abb3ccbc0 (diff)
downloadwallabag-6e68417f0356d0045d7a2aa3832507d362ddcfe8.tar.gz
wallabag-6e68417f0356d0045d7a2aa3832507d362ddcfe8.tar.zst
wallabag-6e68417f0356d0045d7a2aa3832507d362ddcfe8.zip
Fix tests after rebase
-rw-r--r--src/Wallabag/CoreBundle/Helper/ContentProxy.php6
-rw-r--r--tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php20
2 files changed, 12 insertions, 14 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php
index 59465ad1..c6fa0d98 100644
--- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php
+++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php
@@ -299,8 +299,6 @@ class ContentProxy
299 // if content is an image, define it as a preview too 299 // if content is an image, define it as a preview too
300 if (!empty($content['headers']['content-type']) && \in_array($this->mimeGuesser->guess($content['headers']['content-type']), ['jpeg', 'jpg', 'gif', 'png'], true)) { 300 if (!empty($content['headers']['content-type']) && \in_array($this->mimeGuesser->guess($content['headers']['content-type']), ['jpeg', 'jpg', 'gif', 'png'], true)) {
301 $previewPictureUrl = $content['url']; 301 $previewPictureUrl = $content['url'];
302
303 $entry->setMimetype($content['headers']['content-type']);
304 } elseif (empty($previewPictureUrl)) { 302 } elseif (empty($previewPictureUrl)) {
305 $this->logger->debug('Extracting images from content to provide a default preview picture'); 303 $this->logger->debug('Extracting images from content to provide a default preview picture');
306 $imagesUrls = DownloadImages::extractImagesUrlsFromHtml($content['html']); 304 $imagesUrls = DownloadImages::extractImagesUrlsFromHtml($content['html']);
@@ -311,6 +309,10 @@ class ContentProxy
311 } 309 }
312 } 310 }
313 311
312 if (!empty($content['headers']['content-type'])) {
313 $entry->setMimetype($content['headers']['content-type']);
314 }
315
314 if (!empty($previewPictureUrl)) { 316 if (!empty($previewPictureUrl)) {
315 $this->updatePreviewPicture($entry, $previewPictureUrl); 317 $this->updatePreviewPicture($entry, $previewPictureUrl);
316 } 318 }
diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
index c123e7e6..9ce72c79 100644
--- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
@@ -232,14 +232,12 @@ class ContentProxyTest extends TestCase
232 'html' => "<h1>Test</h1><p><img src='http://3.3.3.3/cover.jpg'/></p>", 232 'html' => "<h1>Test</h1><p><img src='http://3.3.3.3/cover.jpg'/></p>",
233 'title' => 'this is my title', 233 'title' => 'this is my title',
234 'url' => 'http://1.1.1.1', 234 'url' => 'http://1.1.1.1',
235 'content_type' => 'text/html', 235 'headers' => [
236 'content-type' => 'text/html',
237 ],
236 'language' => 'fr', 238 'language' => 'fr',
237 'status' => '200', 239 'status' => '200',
238 'open_graph' => [ 240 'image' => null,
239 'og_title' => 'my OG title',
240 'og_description' => 'OG desc',
241 'og_image' => null,
242 ],
243 ]); 241 ]);
244 242
245 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage); 243 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
@@ -274,14 +272,12 @@ class ContentProxyTest extends TestCase
274 'html' => "<h1>Test</h1><p><img src='http://3.3.3.3/nevermind.jpg'/></p>", 272 'html' => "<h1>Test</h1><p><img src='http://3.3.3.3/nevermind.jpg'/></p>",
275 'title' => 'this is my title', 273 'title' => 'this is my title',
276 'url' => 'http://1.1.1.1', 274 'url' => 'http://1.1.1.1',
277 'content_type' => 'text/html', 275 'headers' => [
276 'content-type' => 'text/html',
277 ],
278 'language' => 'fr', 278 'language' => 'fr',
279 'status' => '200', 279 'status' => '200',
280 'open_graph' => [ 280 'image' => 'http://3.3.3.3/cover.jpg',
281 'og_title' => 'my OG title',
282 'og_description' => 'OG desc',
283 'og_image' => 'http://3.3.3.3/cover.jpg',
284 ],
285 ]); 281 ]);
286 282
287 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage); 283 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);