Fixing tests

This commit is contained in:
Jeremy Benoist
2016-10-30 11:27:09 +01:00
parent 7f55941856
commit 48656e0eaa
7 changed files with 63 additions and 23 deletions

View 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();