only in patch2:
unchanged:
--- a/core/tests/Drupal/KernelTests/Core/Render/RenderTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Render/RenderTest.php
@@ -16,7 +16,7 @@ class RenderTest extends KernelTestBase {
*
* @var array
*/
- public static $modules = array('system', 'common_test');
+ public static $modules = array('system', 'common_test', 'theme_test');
/**
* Tests theme preprocess functions being able to attach assets.
@@ -44,6 +44,23 @@ function testDrupalRenderThemePreprocessAttached() {
}
/**
+ * Ensures that render array children are processed correctly.
+ */
+ public function testRenderChildren() {
+ // Ensure that #prefix and #suffix is only being printed once since that is
+ // the behaviour the caller code expects.
+ $build = [
+ '#type' => 'container',
+ '#theme' => 'theme_test_render_element_children',
+ '#prefix' => 'kangaroo',
+ '#suffix' => 'kitten',
+ ];
+ $this->render($build);
+ $this->removeWhiteSpace();
+ $this->assertNoRaw('
kangarookitten
');
+ }
+
+ /**
* Tests that we get an exception when we try to attach an illegal type.
*/
public function testProcessAttached() {
only in patch2:
unchanged:
--- a/core/tests/Drupal/Tests/Core/Render/RendererTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/RendererTest.php
@@ -363,6 +363,25 @@ public function providerTestRenderBasic() {
};
$data[] = [$build, 'baz', $setup_code];
+ // #theme is implemented but #render_children is TRUE. In this case the
+ // calling code is expecting only the children to be rendered. #prefix and
+ // #suffix should not be inherited for the children.
+ $build = [
+ '#theme' => 'common_test_foo',
+ '#children' => '',
+ '#prefix' => 'kangaroo',
+ '#suffix' => 'unicorn',
+ '#render_children' => TRUE,
+ 'child' => [
+ '#markup' => 'kitten',
+ ],
+ ];
+ $setup_code = function() {
+ $this->themeManager->expects($this->never())
+ ->method('render');
+ };
+ $data[] = [$build, 'kitten', $setup_code];
+
return $data;
}