function ThemeTest::testDrupalRenderChildren
Same name in other branches
- 8.9.x core/modules/system/tests/src/Kernel/Theme/ThemeTest.php \Drupal\Tests\system\Kernel\Theme\ThemeTest::testDrupalRenderChildren()
- 10 core/modules/system/tests/src/Kernel/Theme/ThemeTest.php \Drupal\Tests\system\Kernel\Theme\ThemeTest::testDrupalRenderChildren()
- 11.x core/modules/system/tests/src/Kernel/Theme/ThemeTest.php \Drupal\Tests\system\Kernel\Theme\ThemeTest::testDrupalRenderChildren()
Tests child element rendering for 'render element' theme hooks.
File
-
core/
modules/ system/ tests/ src/ Kernel/ Theme/ ThemeTest.php, line 131
Class
- ThemeTest
- Tests low-level theme functions.
Namespace
Drupal\Tests\system\Kernel\ThemeCode
public function testDrupalRenderChildren() {
$element = [
'#theme' => 'theme_test_render_element_children',
'child' => [
'#markup' => 'Foo',
],
];
$this->assertThemeOutput('theme_test_render_element_children', $element, 'Foo', "\\Drupal::service('renderer')->render() avoids #theme recursion loop when rendering a render element.");
$element = [
'#theme_wrappers' => [
'theme_test_render_element_children',
],
'child' => [
'#markup' => 'Foo',
],
];
$this->assertThemeOutput('theme_test_render_element_children', $element, 'Foo', "\\Drupal::service('renderer')->render() avoids #theme_wrappers recursion loop when rendering a render element.");
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.