function KernelTestBaseTest::testRender
Same name in other branches
- 9 core/tests/Drupal/KernelTests/KernelTestBaseTest.php \Drupal\KernelTests\KernelTestBaseTest::testRender()
- 8.9.x core/tests/Drupal/KernelTests/KernelTestBaseTest.php \Drupal\KernelTests\KernelTestBaseTest::testRender()
- 10 core/tests/Drupal/KernelTests/KernelTestBaseTest.php \Drupal\KernelTests\KernelTestBaseTest::testRender()
@covers ::render
File
-
core/
tests/ Drupal/ KernelTests/ KernelTestBaseTest.php, line 181
Class
- KernelTestBaseTest
- @coversDefaultClass \Drupal\KernelTests\KernelTestBase
Namespace
Drupal\KernelTestsCode
public function testRender() : void {
$type = 'processed_text';
$element_info = $this->container
->get('element_info');
$this->assertSame([
'#defaults_loaded' => TRUE,
], $element_info->getInfo($type));
$this->enableModules([
'filter',
]);
$this->assertNotSame($element_info, $this->container
->get('element_info'));
$this->assertNotEmpty($this->container
->get('element_info')
->getInfo($type));
$build = [
'#type' => 'html_tag',
'#tag' => 'h3',
'#value' => 'Inner',
];
$expected = "<h3>Inner</h3>\n";
$this->assertEquals('core', \Drupal::theme()->getActiveTheme()
->getName());
$output = \Drupal::service('renderer')->renderRoot($build);
$this->assertEquals('core', \Drupal::theme()->getActiveTheme()
->getName());
$this->assertSame($expected, (string) $build['#markup']);
$this->assertSame($expected, (string) $output);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.