public function FunctionsTest::testImage in Drupal 9
Same name and namespace in other branches
- 8 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);
}