function RendererPlaceholdersTest::generatePlaceholderWithLazyBuilderPreview

Same name in other branches
  1. 10 core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php \Drupal\Tests\Core\Render\RendererPlaceholdersTest::generatePlaceholderWithLazyBuilderPreview()

Generates an element with a lazy builder and preview.

1 call to RendererPlaceholdersTest::generatePlaceholderWithLazyBuilderPreview()
RendererPlaceholdersTest::testRenderLazyBuilderPreview in core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php
Tests the creation of an element with a lazy_builder_preview.

File

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

Class

RendererPlaceholdersTest
@coversDefaultClass \Drupal\Core\Render\Renderer @covers \Drupal\Core\Render\RenderCache @covers \Drupal\Core\Render\PlaceholderingRenderCache @group Render

Namespace

Drupal\Tests\Core\Render

Code

public function generatePlaceholderWithLazyBuilderPreview() : array {
    return [
        '#cache' => [
            'keys' => [
                'test_render',
            ],
        ],
        '#lazy_builder' => [
            __NAMESPACE__ . '\\PlaceholdersTest::callbackPerUser',
            [
                'foo',
            ],
        ],
        '#lazy_builder_preview' => [
            '#markup' => 'Lazy Builder Preview',
        ],
    ];
}

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