function KernelTestBase::render

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::render()
  2. 8.9.x core/modules/simpletest/src/KernelTestBase.php \Drupal\simpletest\KernelTestBase::render()
  3. 8.9.x core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::render()
  4. 10 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).

49 calls to KernelTestBase::render()
AreaOrderTest::testAreaOrder in core/modules/views/tests/src/Kernel/Handler/AreaOrderTest.php
Tests the order of the handlers.
BooleanFormatterTest::renderEntityFields in core/modules/field/tests/src/Kernel/Boolean/BooleanFormatterTest.php
Renders fields of a given entity with a given display.
ClaroTableTest::testThemeTableStickyHeaders in core/tests/Drupal/KernelTests/Core/Theme/ClaroTableTest.php
Confirm that Claro tables override use of the `sticky-enabled` class.
ClaroVerticalTabsTest::testVerticalTabs in core/tests/Drupal/KernelTests/Core/Theme/ClaroVerticalTabsTest.php
Confirms that Claro can render vertical tabs correctly.
DatelistElementFormTest::testDatelistElement in core/tests/Drupal/KernelTests/Core/Datetime/DatelistElementFormTest.php
Tests that trusted callbacks are executed.

... See full list

1 method overrides KernelTestBase::render()
LayoutTest::render in core/modules/layout_discovery/tests/src/Kernel/LayoutTest.php
Renders a render array.

File

core/tests/Drupal/KernelTests/KernelTestBase.php, line 925

Class

KernelTestBase
Base class for functional integration tests.

Namespace

Drupal\KernelTests

Code

protected function render(array &$elements) {
    // \Drupal\Core\Render\BareHtmlPageRenderer::renderBarePage calls out to
    // system_page_attachments() directly.
    if (!\Drupal::moduleHandler()->moduleExists('system')) {
        throw new \Exception(__METHOD__ . ' requires system module to be installed.');
    }
    // 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);
    return $content;
}

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