function ImageTest::testThemeImageWithSrc in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Theme/ImageTest.php \Drupal\system\Tests\Theme\ImageTest::testThemeImageWithSrc()
Tests that an image with the src attribute is output correctly.
File
- core/
modules/ system/ src/ Tests/ Theme/ ImageTest.php, line 65 - Contains \Drupal\system\Tests\Theme\ImageTest.
Class
- ImageTest
- Tests built-in image theme functions.
Namespace
Drupal\system\Tests\ThemeCode
function testThemeImageWithSrc() {
$image = array(
'#theme' => 'image',
'#uri' => reset($this->testImages),
'#width' => rand(0, 1000) . 'px',
'#height' => rand(0, 500) . 'px',
'#alt' => $this
->randomMachineName(),
'#title' => $this
->randomMachineName(),
);
$this
->render($image);
// Make sure the src attribute has the correct value.
$this
->assertRaw(file_create_url($image['#uri']), 'Correct output for an image with the src attribute.');
}