Commit 12bd5c7f authored by Dries's avatar Dries

- Patch #1696416 by tim.plunkett: theme_image_style() is broken.

parent bf24773d
......@@ -180,7 +180,7 @@ function image_theme() {
'image_style' => array(
'variables' => array(
'style_name' => NULL,
'path' => NULL,
'uri' => NULL,
'width' => NULL,
'height' => NULL,
'alt' => '',
......
......@@ -68,4 +68,28 @@ function testImageFormatterTheme() {
$this->assertEqual($expected_result, $rendered_element, 'theme_image_formatter() correctly renders a link fragment.');
}
/**
* Tests usage of the image style theme function.
*/
function testImageStyleTheme() {
// Create an image.
$files = $this->drupalGetTestFiles('image');
$file = reset($files);
$original_uri = file_unmanaged_copy($file->uri, 'public://', FILE_EXISTS_RENAME);
// Create a style.
image_style_save(array('name' => 'test'));
$url = image_style_url('test', $original_uri);
$path = $this->randomName();
$element = array(
'#theme' => 'image_style',
'#style_name' => 'test',
'#uri' => $original_uri,
);
$rendered_element = render($element);
$expected_result = '<img src="' . $url . '" alt="" />';
$this->assertEqual($expected_result, $rendered_element, 'theme_image_style() renders an image correctly.');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment