function FunctionsTest::testImage
Tests theme_image().
File
- 
              core/
modules/ system/ tests/ src/ Kernel/ Theme/ FunctionsTest.php, line 523  
Class
- FunctionsTest
 - Tests for common theme functions.
 
Namespace
Drupal\Tests\system\Kernel\ThemeCode
public function testImage() {
  // Test that data URIs work with theme_image().
  $variables = [];
  $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);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.