]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php
Fixing tests
[github/wallabag/wallabag.git] / tests / Wallabag / CoreBundle / Helper / DownloadImagesTest.php
index 0273693ec65605f2bfb038d83fe953f788dab7e1..e000d6817b55e8c6792ac2034589910605835bfe 100644 (file)
@@ -83,6 +83,25 @@ class DownloadImagesTest extends \PHPUnit_Framework_TestCase
         $this->assertContains('/assets/images/4/2/4258f71e/ebe60399.'.$extension, $res);
     }
 
+    public function testProcessSingleImageWithBadUrl()
+    {
+        $client = new Client();
+
+        $mock = new Mock([
+            new Response(404, []),
+        ]);
+
+        $client->getEmitter()->attach($mock);
+
+        $logHandler = new TestHandler();
+        $logger = new Logger('test', array($logHandler));
+
+        $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', $logger);
+        $res = $download->processSingleImage('T9qgcHc.jpg', 'http://imgur.com/gallery/WxtWY');
+
+        $this->assertFalse($res, 'Image can not be found, so it will not be replaced');
+    }
+
     public function testProcessSingleImageWithBadImage()
     {
         $client = new Client();