diff --git a/core/modules/system/src/Tests/Theme/ThemeTest.php b/core/modules/system/src/Tests/Theme/ThemeTest.php index 4697c2f..a0095b8 100644 --- a/core/modules/system/src/Tests/Theme/ThemeTest.php +++ b/core/modules/system/src/Tests/Theme/ThemeTest.php @@ -63,14 +63,15 @@ function testThemeDataTypes() { // theme_test_false is an implemented theme hook so \Drupal::theme() service // should return a string or an object that implements SafeStringInterface, // even though the theme function itself can return anything. - $foos = array('null' => NULL, 'false' => FALSE, 'integer' => 1, 'string' => 'foo'); + $foos = array('null' => NULL, 'false' => FALSE, 'integer' => 1, 'string' => 'foo', 'empty_string' => ''); foreach ($foos as $type => $example) { $output = \Drupal::theme()->render('theme_test_foo', array('foo' => $example)); - if (is_string($output)) { - $this->assertIdentical($output, '', format_string('\Drupal::theme() returns a string for data type !type.', array('!type' => $type))); + $this->assertTrue($output instanceof SafeStringInterface || is_string($output), format_string('\Drupal::theme() returns an object that implements SafeStringInterface or a string for data type !type.', array('!type' => $type))); + if ($output instanceof SafeStringInterface) { + $this->assertIdentical((string) $example, $output->__toString()); } - else { - $this->assertTrue($output instanceof SafeStringInterface, format_string('\Drupal::theme() returns an object that implements SafeStringInterface for data type !type.', array('!type' => $type))); + elseif (is_string($output)) { + $this->assertIdentical($output, '', 'A string will be return when the theme returns an empty string.'); } } diff --git a/core/modules/system/templates/dropbutton-wrapper.html.twig b/core/modules/system/templates/dropbutton-wrapper.html.twig index d4c8d90..358250a 100644 --- a/core/modules/system/templates/dropbutton-wrapper.html.twig +++ b/core/modules/system/templates/dropbutton-wrapper.html.twig @@ -12,7 +12,7 @@ * @ingroup themeable */ #} -{% if children|length %} +{% if children is not empty %} {% spaceless %}
diff --git a/core/themes/classy/templates/form/dropbutton-wrapper.html.twig b/core/themes/classy/templates/form/dropbutton-wrapper.html.twig index 5dccc85..f162425 100644 --- a/core/themes/classy/templates/form/dropbutton-wrapper.html.twig +++ b/core/themes/classy/templates/form/dropbutton-wrapper.html.twig @@ -10,7 +10,7 @@ * @see template_preprocess_dropbutton_wrapper() */ #} -{% if children %} +{% if children is not empty %} {% spaceless %}