function RendererPlaceholdersTest::testScalarLazybuilderCallbackContext
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php \Drupal\Tests\Core\Render\RendererPlaceholdersTest::testScalarLazybuilderCallbackContext()
- 10 core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php \Drupal\Tests\Core\Render\RendererPlaceholdersTest::testScalarLazyBuilderCallbackContext()
- 11.x 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 880
Class
- RendererPlaceholdersTest
- @coversDefaultClass \Drupal\Core\Render\Renderer @covers \Drupal\Core\Render\RenderCache @covers \Drupal\Core\Render\PlaceholderingRenderCache @group Render
Namespace
Drupal\Tests\Core\RenderCode
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);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.