function RendererTest::testRenderTwice
Tests rendering same render array twice.
Tests that a first render returns the rendered output and a second doesn't because of the #printed property. Also tests that correct metadata has been set for re-rendering.
@covers ::render
      
    
@covers ::doRender
      
    
@dataProvider providerRenderTwice
File
- 
              core/tests/ Drupal/ Tests/ Core/ Render/ RendererTest.php, line 654 
Class
- RendererTest
- @coversDefaultClass \Drupal\Core\Render\Renderer[[api-linebreak]] @group Render
Namespace
Drupal\Tests\Core\RenderCode
public function testRenderTwice($build) : void {
  $this->assertEquals('kittens', $this->renderer
    ->renderRoot($build));
  $this->assertEquals('kittens', $build['#markup']);
  $this->assertEquals([
    'kittens-147',
  ], $build['#cache']['tags']);
  $this->assertTrue($build['#printed']);
  // We don't want to reprint already printed render arrays.
  $this->assertEquals('', $this->renderer
    ->renderRoot($build));
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
