public function ThemeTest::testDrupalRenderChildren in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/tests/src/Kernel/Theme/ThemeTest.php \Drupal\Tests\system\Kernel\Theme\ThemeTest::testDrupalRenderChildren()
- 9 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.");
}