diff --git a/core/modules/system/src/Tests/Theme/ThemeTest.php b/core/modules/system/src/Tests/Theme/ThemeTest.php index c2c0e0b..5503fea 100644 --- a/core/modules/system/src/Tests/Theme/ThemeTest.php +++ b/core/modules/system/src/Tests/Theme/ThemeTest.php @@ -60,11 +60,16 @@ function testAttributeMerging() { */ function testThemeDataTypes() { // theme_test_false is an implemented theme hook so \Drupal::theme() service should - // return a string, even though the theme function itself can return anything. + // 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'); foreach ($foos as $type => $example) { $output = \Drupal::theme()->render('theme_test_foo', array('foo' => $example)); - $this->assertTrue(is_string($output), format_string('\Drupal::theme() returns a string for data type !type.', array('!type' => $type))); + if (is_string($output)) { + $this->assertTrue(TRUE, format_string('\Drupal::theme() returns a string for data type !type.', array('!type' => $type))); + } else { + $this->assertTrue($output instanceof SafeStringInterface, format_string('\Drupal::theme() returns an object that implements SafeStringInterface for data type !type.', array('!type' => $type))); + } } // suggestionnotimplemented is not an implemented theme hook so \Drupal::theme() service