From 12bd5c7f2d177a53a5beab148869378e06911f0e Mon Sep 17 00:00:00 2001
From: Dries <dries@buytaert.net>
Date: Tue, 24 Jul 2012 14:25:12 -0400
Subject: [PATCH] - Patch #1696416 by tim.plunkett: theme_image_style() is
 broken.

---
 core/modules/image/image.module               |  2 +-
 .../image/Tests/ImageThemeFunctionTest.php    | 24 +++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/core/modules/image/image.module b/core/modules/image/image.module
index 397ac95285e8..aa05d0488825 100644
--- a/core/modules/image/image.module
+++ b/core/modules/image/image.module
@@ -180,7 +180,7 @@ function image_theme() {
     'image_style' => array(
       'variables' => array(
         'style_name' => NULL,
-        'path' => NULL,
+        'uri' => NULL,
         'width' => NULL,
         'height' => NULL,
         'alt' => '',
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageThemeFunctionTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageThemeFunctionTest.php
index ed01b23d7c7b..3c615966de49 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageThemeFunctionTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageThemeFunctionTest.php
@@ -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.');
+  }
+
 }
-- 
GitLab