protected function ImageDimensionsTest::getImageTag in Drupal 8
Same name and namespace in other branches
- 9 core/modules/image/tests/src/Functional/ImageDimensionsTest.php \Drupal\Tests\image\Functional\ImageDimensionsTest::getImageTag()
Render an image style element.
Function drupal_render() alters the passed $variables array by adding a new key '#printed' => TRUE. This prevents next call to re-render the element. We wrap drupal_render() in a helper protected method and pass each time a fresh array so that $variables won't get altered and the element is re-rendered each time.
1 call to ImageDimensionsTest::getImageTag()
- ImageDimensionsTest::testImageDimensions in core/
modules/ image/ tests/ src/ Functional/ ImageDimensionsTest.php - Test styled image dimensions cumulatively.
File
- core/
modules/ image/ tests/ src/ Functional/ ImageDimensionsTest.php, line 303
Class
- ImageDimensionsTest
- Tests that images have correct dimensions when styled.
Namespace
Drupal\Tests\image\FunctionalCode
protected function getImageTag($variables) {
return str_replace("\n", NULL, \Drupal::service('renderer')
->renderRoot($variables));
}