Skip to content
Snippets Groups Projects
Commit 12bd5c7f authored by Dries Buytaert's avatar Dries Buytaert
Browse files

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

parent bf24773d
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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.');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment