function RendererPlaceholdersTest::testNonArrayReturnFromLazyBuilder
Same name in other branches
- 10 core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php \Drupal\Tests\Core\Render\RendererPlaceholdersTest::testNonArrayReturnFromLazyBuilder()
- 11.x core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php \Drupal\Tests\Core\Render\RendererPlaceholdersTest::testNonArrayReturnFromLazyBuilder()
Tests that an error is thrown if a lazy builder doesn't return an array.
File
-
core/
tests/ Drupal/ Tests/ Core/ Render/ RendererPlaceholdersTest.php, line 971
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 testNonArrayReturnFromLazyBuilder() : void {
$element = [
'#lazy_builder' => [
'\\Drupal\\Tests\\Core\\Render\\PlaceholdersTest::callbackNonArrayReturn',
[],
],
];
$this->expectException('AssertionError');
$this->expectExceptionMessage("#lazy_builder callbacks must return a valid renderable array, got boolean from \\Drupal\\Tests\\Core\\Render\\PlaceholdersTest::callbackNonArrayReturn");
$this->renderer
->renderRoot($element);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.