You are here

function FunctionsTest::testImage in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Theme/FunctionsTest.php \Drupal\system\Tests\Theme\FunctionsTest::testImage()

Tests theme_image().

File

core/modules/system/src/Tests/Theme/FunctionsTest.php, line 393
Contains \Drupal\system\Tests\Theme\FunctionsTest.

Class

FunctionsTest
Tests for common theme functions.

Namespace

Drupal\system\Tests\Theme

Code

function testImage() {

  // Test that data URIs work with theme_image().
  $variables = array();
  $variables['uri'] = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==';
  $variables['alt'] = 'Data URI image of a red dot';
  $expected = '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Data URI image of a red dot" />' . "\n";
  $this
    ->assertThemeOutput('image', $variables, $expected);
}