function ImagecacheExternalTestCase::_testCachingExternalImageWithImageStyle in Imagecache External 8
Same name and namespace in other branches
- 7.2 imagecache_external.test \ImagecacheExternalTestCase::_testCachingExternalImageWithImageStyle()
Test caching an external image with an image style.
2 calls to ImagecacheExternalTestCase::_testCachingExternalImageWithImageStyle()
- ImagecacheExternalTestCase::testCachingExternalImageWithImageStylePrivate in ./
imagecache_external.test - Test caching an external image with style using the private:// scheme.
- ImagecacheExternalTestCase::testCachingExternalImageWithImageStylePublic in ./
imagecache_external.test - Test caching an external image with style using the public:// scheme.
File
- ./
imagecache_external.test, line 156 - Tests for Imagecache External.
Class
- ImagecacheExternalTestCase
- Tests the functions for working with public/private file schemes.
Code
function _testCachingExternalImageWithImageStyle($scheme) {
$style = image_style_save([
'name' => rand(),
]);
variable_set('file_default_scheme', $scheme);
$local_image_uri = imagecache_external_generate_path($this->external_image_uri);
$local_image_url = image_style_url($style['name'], $local_image_uri);
// Check if we can access the generated image.
$this
->drupalGet($local_image_url);
$this
->assertResponse(200, t('Image can be reached on %url', [
'%url' => $local_image_url,
]));
// // Check if the theme function works as expected.
// $img_tag = theme_imagecache_external([
// 'style_name' => $style['name'],
// 'path' => $this->external_image_uri,
// 'alt' => 'Drupal logo',
// 'width' => 20,
// 'height' => 20,
// ]);
// $expected_tag = '<img typeof="foaf:Image" src="' . check_plain($local_image_url) . '" width="20" height="20" alt="Drupal logo" />';
// $this->assertEqual($img_tag, $expected_tag, t('Expected img tag %tag was found on the %scheme filesystem.', [
// '%tag' => $expected_tag,
// '%scheme' => $scheme,
// ]));
}