You are here

private function ImageViewBuilderTest::renderPlain in Twig Tweak 3.1.x

Same name and namespace in other branches
  1. 3.x tests/src/Kernel/ImageViewBuilderTest.php \Drupal\Tests\twig_tweak\Kernel\ImageViewBuilderTest::renderPlain()

Renders a render array.

1 call to ImageViewBuilderTest::renderPlain()
ImageViewBuilderTest::testImageViewBuilder in tests/src/Kernel/ImageViewBuilderTest.php
Test callback.

File

tests/src/Kernel/ImageViewBuilderTest.php, line 155

Class

ImageViewBuilderTest
A test for ImageViewBuilderTest.

Namespace

Drupal\Tests\twig_tweak\Kernel

Code

private function renderPlain(array $build) : string {
  $html = $this->container
    ->get('renderer')
    ->renderPlain($build);
  $html = preg_replace('#src=".+/files/#s', 'src="/files/', $html);
  $html = preg_replace('#\\?itok=.+"#', '?itok=abc"', $html);
  $html = preg_replace([
    '#\\s{2,}#',
    '#\\n#',
  ], '', $html);
  return rtrim($html);
}