You are here

protected function ImageEffectsTestBase::getImageTag in Image Effects 8

Same name and namespace in other branches
  1. 8.3 tests/src/Functional/ImageEffectsTestBase.php \Drupal\Tests\image_effects\Functional\ImageEffectsTestBase::getImageTag()
  2. 8.2 tests/src/Functional/ImageEffectsTestBase.php \Drupal\Tests\image_effects\Functional\ImageEffectsTestBase::getImageTag()

Render an image style element.

The ::renderRoot method alters the passed $variables array by adding a new key '#printed' => TRUE. This prevents next call to re-render the element. We wrap ::renderRoot() 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.

10 calls to ImageEffectsTestBase::getImageTag()
AspectSwitcherTest::testAspectSwitcherEffect in tests/src/Functional/Effect/AspectSwitcherTest.php
AspectSwitcher effect test.
AutoOrientTest::testAutoOrientEffect in tests/src/Functional/Effect/AutoOrientTest.php
Auto Orientation effect test.
BackgroundTest::testBackgroundEffect in tests/src/Functional/Effect/BackgroundTest.php
Background effect test.
ImagemagickArgumentsTest::testImagemagickArgumentsEffect in tests/src/Functional/Effect/ImagemagickArgumentsTest.php
ImageMagick arguments effect test.
ResizePercentageTest::testResizePercentage in tests/src/Functional/Effect/ResizePercentageTest.php
Test the dimensions are resized properly.

... See full list

File

tests/src/Functional/ImageEffectsTestBase.php, line 154

Class

ImageEffectsTestBase
Base test class for image_effects tests.

Namespace

Drupal\Tests\image_effects\Functional

Code

protected function getImageTag($variables) {
  return str_replace("\n", NULL, \Drupal::service('renderer')
    ->renderRoot($variables));
}