function FunctionsTest::testImage
Same name in other branches
- 8.9.x core/modules/system/tests/src/Kernel/Theme/FunctionsTest.php \Drupal\Tests\system\Kernel\Theme\FunctionsTest::testImage()
- 10 core/modules/system/tests/src/Kernel/Theme/FunctionsTest.php \Drupal\Tests\system\Kernel\Theme\FunctionsTest::testImage()
- 11.x core/modules/system/tests/src/Kernel/Theme/FunctionsTest.php \Drupal\Tests\system\Kernel\Theme\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.