function KernelTestBase::render

Same name in this branch
  1. 8.9.x core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::render()
Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::render()
  2. 10 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::render()
  3. 11.x core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::render()

Renders a render array.

Parameters

array $elements: The elements to render.

Return value

string The rendered string output (typically HTML).

File

core/modules/simpletest/src/KernelTestBase.php, line 639

Class

KernelTestBase
Base class for functional integration tests.

Namespace

Drupal\simpletest

Code

protected function render(array &$elements) {
    // Use the bare HTML page renderer to render our links.
    $renderer = $this->container
        ->get('bare_html_page_renderer');
    $response = $renderer->renderBarePage($elements, '', 'maintenance_page');
    // Glean the content from the response object.
    $content = $response->getContent();
    $this->setRawContent($content);
    $this->verbose('<pre style="white-space: pre-wrap">' . Html::escape($content));
    return $content;
}

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