diff options
author | Simounet <contact@simounet.net> | 2018-06-03 22:52:48 +0200 |
---|---|---|
committer | Simounet <contact@simounet.net> | 2018-07-05 11:40:51 +0200 |
commit | 3fbbe0d9f1887d939fdb56733612f8ab0971deaf (patch) | |
tree | 7e7191a4ed794eb9043361499bdf9c704018c488 /tests | |
parent | e586d65b64089fc1cc230a18c470aae3f45f91a6 (diff) | |
download | wallabag-3fbbe0d9f1887d939fdb56733612f8ab0971deaf.tar.gz wallabag-3fbbe0d9f1887d939fdb56733612f8ab0971deaf.tar.zst wallabag-3fbbe0d9f1887d939fdb56733612f8ab0971deaf.zip |
Fix image downloading on null image path
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php index 51ab1bcd..faa803fa 100644 --- a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php +++ b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php | |||
@@ -204,4 +204,27 @@ class DownloadImagesTest extends TestCase | |||
204 | 204 | ||
205 | $this->assertNotContains('http://piketty.blog.lemonde.fr/', $res, 'Image srcset attribute were not replaced'); | 205 | $this->assertNotContains('http://piketty.blog.lemonde.fr/', $res, 'Image srcset attribute were not replaced'); |
206 | } | 206 | } |
207 | |||
208 | public function testProcessImageWithNullPath() | ||
209 | { | ||
210 | $client = new Client(); | ||
211 | |||
212 | $mock = new Mock([ | ||
213 | new Response(200, ['content-type' => null], Stream::factory(file_get_contents(__DIR__ . '/../fixtures/image-no-content-type.jpg'))), | ||
214 | ]); | ||
215 | |||
216 | $client->getEmitter()->attach($mock); | ||
217 | |||
218 | $logHandler = new TestHandler(); | ||
219 | $logger = new Logger('test', [$logHandler]); | ||
220 | |||
221 | $download = new DownloadImages($client, sys_get_temp_dir() . '/wallabag_test', 'http://wallabag.io/', $logger); | ||
222 | |||
223 | $res = $download->processSingleImage( | ||
224 | 123, | ||
225 | null, | ||
226 | 'https://framablog.org/2018/06/30/engagement-atypique/' | ||
227 | ); | ||
228 | $this->assertFalse($res); | ||
229 | } | ||
207 | } | 230 | } |