function KernelTestBase::render
Same name and namespace in other branches
- 8.9.x core/modules/simpletest/src/KernelTestBase.php \Drupal\simpletest\KernelTestBase::render()
- 11.x core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::render()
- 10 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::render()
- 8.9.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).
2 calls to KernelTestBase::render()
- DatelistElementFormTest::testDatelistElement in core/
tests/ Drupal/ KernelTests/ Core/ Datetime/ DatelistElementFormTest.php - Tests that trusted callbacks are executed.
- DatelistElementFormTest::testDatelistElementUntrustedCallbacks in core/
tests/ Drupal/ KernelTests/ Core/ Datetime/ DatelistElementFormTest.php - Tests that deprecations are raised if untrusted callbacks are used.
File
-
core/
tests/ Drupal/ KernelTests/ KernelTestBase.php, line 911
Class
- KernelTestBase
- Base class for functional integration tests.
Namespace
Drupal\KernelTestsCode
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.