protected function KernelTestBase::render in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::render()
- 9 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).
17 calls to KernelTestBase::render()
- BooleanFormatterTest::renderEntityFields in core/
modules/ field/ tests/ src/ Kernel/ Boolean/ BooleanFormatterTest.php - Renders fields of a given entity with a given display.
- ClassyTest::testClassyTheme in core/
modules/ system/ tests/ src/ Kernel/ Render/ ClassyTest.php - Tests the classy theme.
- DatelistElementFormTest::testDatelistElement in core/
tests/ Drupal/ KernelTests/ Core/ Datetime/ DatelistElementFormTest.php - Tests that trusted callbacks are executed.
- DatetimeElementFormTest::testDatetimeElement in core/
tests/ Drupal/ KernelTests/ Core/ Datetime/ DatetimeElementFormTest.php - Tests that default handlers are added even if custom are specified.
- DatetimeElementFormTest::testDatetimeElementUntrustedCallbacks in core/
tests/ Drupal/ KernelTests/ Core/ Datetime/ DatetimeElementFormTest.php - Tests that deprecations are raised if untrusted callbacks are used.
File
- core/
tests/ Drupal/ KernelTests/ KernelTestBase.php, line 888
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;
}