X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FWallabag%2FCoreBundle%2FHelper%2FDownloadImagesTest.php;h=9125f8dcb2da20fbeb0ebd61a67efbdba11f00dc;hb=9fe87bc2e20fa95573287a61ef9798cc15648187;hp=85f12d87b27277f7f8a543fc0d947798d35c82ce;hpb=68003139e133835805b143b62c4407f19b495dab;p=github%2Fwallabag%2Fwallabag.git diff --git a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php index 85f12d87..9125f8dc 100644 --- a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php +++ b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php @@ -12,7 +12,24 @@ use GuzzleHttp\Stream\Stream; class DownloadImagesTest extends \PHPUnit_Framework_TestCase { - public function testProcessHtml() + public function dataForSuccessImage() + { + return [ + 'imgur' => [ + '
', + 'http://imgur.com/gallery/WxtWY', + ], + 'image with &' => [ + '
', + 'https://www.tvaddons.ag/realdebrid-kodi-jarvis/', + ], + ]; + } + + /** + * @dataProvider dataForSuccessImage + */ + public function testProcessHtml($html, $url) { $client = new Client(); @@ -27,9 +44,10 @@ class DownloadImagesTest extends \PHPUnit_Framework_TestCase $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger); - $res = $download->processHtml(123, '
', 'http://imgur.com/gallery/WxtWY'); + $res = $download->processHtml(123, $html, $url); - $this->assertContains('http://wallabag.io/assets/images/9/b/9b0ead26/c638b4c2.png', $res); + // this the base path of all image (since it's calculated using the entry id: 123) + $this->assertContains('http://wallabag.io/assets/images/9/b/9b0ead26/', $res); } public function testProcessHtmlWithBadImage()