diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php index 9c2105a..390ffe4 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php @@ -50,8 +50,8 @@ function testTwigDebugMarkup() { $node = $this->drupalCreateNode(); $output = _theme('node', node_view($node)); $this->assertTrue(strpos($output, '') !== FALSE, 'Twig debug markup found in theme output when debug is enabled.'); - $this->assertTrue(strpos($output, "CALL: _theme('node')") !== FALSE, 'Theme call information found.'); - $this->assertTrue(strpos($output, 'x node--1' . $extension . PHP_EOL . ' * node--page' . $extension . PHP_EOL . ' * node' . $extension) !== FALSE, 'Suggested template files found in order and node ID specific template shown as current template.'); + $this->assertTrue(strpos($output, "RENDERED THEME HOOK: 'node'") !== FALSE, 'Theme call information found.'); + $this->assertTrue(preg_match('/\* node--1' . $extension . ' \* node--page' . $extension . ' x node' . $extension . '/s', $output ) !== FALSE, 'Suggested template files found in order and node ID specific template shown as current template.'); $template_filename = $templates['node__1']['path'] . '/' . $templates['node__1']['template'] . $extension; $this->assertTrue(strpos($output, "BEGIN OUTPUT from '$template_filename'") !== FALSE, 'Full path to current template file found.'); @@ -59,7 +59,7 @@ function testTwigDebugMarkup() { // debug markup are correct. $node2 = $this->drupalCreateNode(); $output = _theme('node', node_view($node2)); - $this->assertTrue(strpos($output, '* node--2' . $extension . PHP_EOL . ' * node--page' . $extension . PHP_EOL . ' x node' . $extension) !== FALSE, 'Suggested template files found in order and base template shown as current template.'); + $this->assertTrue(preg_match('/\* node--2' . $extension . ' \* node--page' . $extension . ' x node' . $extension . '/s', $output ) !== FALSE, 'Suggested template files found in order and base template shown as current template.'); // Create another node and make sure the template suggestions shown in the // debug markup are correct. @@ -67,8 +67,8 @@ function testTwigDebugMarkup() { $build = array('#theme' => 'node__foo__bar'); $build += node_view($node3); $output = drupal_render($build); - $this->assertTrue(strpos($output, "CALL: _theme('node__foo__bar')") !== FALSE, 'Theme call information found.'); - $this->assertTrue(strpos($output, '* node--foo--bar' . $extension . PHP_EOL . ' * node--foo' . $extension . PHP_EOL . ' * node--3' . $extension . PHP_EOL . ' * node--page' . $extension . PHP_EOL . ' x node' . $extension) !== FALSE, 'Suggested template files found in order and base template shown as current template.'); + $this->assertTrue(strpos($output, "RENDERED THEME HOOK: 'node__foo__bar'") !== FALSE, 'Theme call information found.'); + $this->assertTrue(preg_match('/\* node--foo--bar' . $extension . ' \* node--foo' . $extension . ' \* node--3' . $extension . '/s', $output ) !== FALSE, 'Suggested template files found in order and base template shown as current template.'); // Disable debug, rebuild the service container, and clear all caches. $this->settingsSet('twig_debug', FALSE); diff --git a/core/themes/engines/twig/twig.engine b/core/themes/engines/twig/twig.engine index 74de2b8..eb1d11b 100644 --- a/core/themes/engines/twig/twig.engine +++ b/core/themes/engines/twig/twig.engine @@ -54,7 +54,7 @@ function twig_render_template($template_file, $variables) { ); if (Settings::get('twig_debug', FALSE)) { $output['debug_prefix'] .= "\n\n"; - $output['debug_prefix'] .= "\n"; + $output['debug_prefix'] .= "\n"; // If there are theme suggestions, reverse the array so more specific // suggestions are shown first. if (!empty($variables['theme_hook_suggestions'])) {