You are here

public function RendererPlaceholdersTest::testScalarLazybuilderCallbackContext in Zircon Profile 8

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

@covers ::render @covers ::doRender

See also

testNonScalarLazybuilderCallbackContext

File

core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php, line 844
Contains \Drupal\Tests\Core\Render\RendererPlaceholdersTest.

Class

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

Namespace

Drupal\Tests\Core\Render

Code

public function testScalarLazybuilderCallbackContext() {
  $element = [];
  $element['#lazy_builder'] = [
    '\\Drupal\\Tests\\Core\\Render\\PlaceholdersTest::callback',
    [
      'string' => 'foo',
      'bool' => TRUE,
      'int' => 1337,
      'float' => 3.14,
      'null' => NULL,
    ],
  ];
  $result = $this->renderer
    ->renderRoot($element);
  $this
    ->assertInstanceOf('\\Drupal\\Core\\Render\\Markup', $result);
  $this
    ->assertEquals('<p>This is a rendered placeholder!</p>', (string) $result);
}