You are here

public function RendererTest::testRenderTwice in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Render/RendererTest.php \Drupal\Tests\Core\Render\RendererTest::testRenderTwice()

Tests that a first render returns the rendered output and a second doesn't.

(Because of the #printed property.)

@covers ::render @covers ::doRender

File

core/tests/Drupal/Tests/Core/Render/RendererTest.php, line 506
Contains \Drupal\Tests\Core\Render\RendererTest.

Class

RendererTest
@coversDefaultClass \Drupal\Core\Render\Renderer @group Render

Namespace

Drupal\Tests\Core\Render

Code

public function testRenderTwice() {
  $build = [
    '#markup' => 'test',
  ];
  $this
    ->assertEquals('test', $this->renderer
    ->renderRoot($build));
  $this
    ->assertTrue($build['#printed']);

  // We don't want to reprint already printed render arrays.
  $this
    ->assertEquals('', $this->renderer
    ->renderRoot($build));
}