Skip to content

Commit

Permalink
Fix a issue where download_mode from JSON config has no effect
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurHoaro committed Jul 17, 2018
1 parent d6bc683 commit 221c4fa
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/WebThumbnailer/WebThumbnailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class WebThumbnailer

protected $crop;

protected $downloadMode = self::DOWNLOAD;
protected $downloadMode;

protected $pathType = self::PATH_RELATIVE;

Expand Down
13 changes: 13 additions & 0 deletions tests/WebThumbnailer/WebThumbnailerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,19 @@ public function testHotlinkOpenGraph()
$this->assertEquals($expected, $thumb);
}

/**
* Simple opengraph URL, in hotlink mode set by config file.
*/
public function testHotlinkOpenGraphJsonConfig()
{
$expected = 'http://s1.lemde.fr/image/2016/10/24/644x322/5019472_3_91ef_cette-image-prise-par-la-sonde-americaine-mro_c27bb4fec19310d709347424f93addec.jpg';
$url = self::LOCAL_SERVER . 'default/le-monde.html';
$wt = new WebThumbnailer();
ConfigManager::addFile('tests/WebThumbnailer/resources/settings-hotlink.json');
$thumb = $wt->thumbnail($url);
$this->assertEquals($expected, $thumb);
}

/**
* Duplicate expected thumbnails using the current GD version.
*
Expand Down
11 changes: 11 additions & 0 deletions tests/WebThumbnailer/resources/settings-hotlink.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"settings": {
"default": {
"cache_duration": 3600,
"download_mode": "HOTLINK"
},
"path": {
"cache": "tests/WebThumbnailer/workdir/cache/"
}
}
}

0 comments on commit 221c4fa

Please sign in to comment.