public function KernelTestBaseTest::testRender in Drupal 8
Same name and namespace in other branches
- 9 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 186
Class
- KernelTestBaseTest
- @coversDefaultClass \Drupal\KernelTests\KernelTestBase
Namespace
Drupal\KernelTestsCode
public function testRender() {
$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
->assertEquals($expected, $build['#markup']);
$this
->assertEquals($expected, $output);
}