function RendererPlaceholdersTest::testPropertiesPlusBuilder

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php \Drupal\Tests\Core\Render\RendererPlaceholdersTest::testPropertiesPlusBuilder()
  2. 8.9.x core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php \Drupal\Tests\Core\Render\RendererPlaceholdersTest::testPropertiesPlusBuilder()
  3. 11.x core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php \Drupal\Tests\Core\Render\RendererPlaceholdersTest::testPropertiesPlusBuilder()

@covers ::render
@covers ::doRender

File

core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php, line 914

Class

RendererPlaceholdersTest
@coversDefaultClass \Drupal\Core\Render\Renderer[[api-linebreak]] @covers \Drupal\Core\Render\RenderCache[[api-linebreak]] @covers \Drupal\Core\Render\PlaceholderingRenderCache[[api-linebreak]] @group Render

Namespace

Drupal\Tests\Core\Render

Code

public function testPropertiesPlusBuilder() : void {
  $element = [];
  $element['#lazy_builder'] = [
    'Drupal\\Tests\\Core\\Render\\RecursivePlaceholdersTest::callback',
    [],
  ];
  $element['#llama'] = '#awesome';
  $element['#piglet'] = '#cute';
  $this->expectException(\AssertionError::class);
  $this->expectExceptionMessage('When a #lazy_builder callback is specified, no properties can exist; all properties must be generated by the #lazy_builder callback. You specified the following properties: #llama, #piglet.');
  $this->renderer
    ->renderRoot($element);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.