diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php new file mode 100644 index 0000000..98707a5 --- /dev/null +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php @@ -0,0 +1,55 @@ + 'Twig debug markup', + 'description' => 'Tests Twig debug markup.', + 'group' => 'Theme', + ); + } + + /** + * Tests that debug markup is added to Twig template output. + */ + function testTwigDebugMarkup() { + theme_enable(array('test_theme_twig')); + variable_set('theme_default', 'test_theme_twig'); + // Enable debug, rebuild the service container, and clear all caches. + $this->settingsSet('twig_debug', TRUE); + $this->rebuildContainer(); + $this->resetAll(); + + $output = theme('theme_test_template_test'); + $this->assertTrue(strpos($output, '') !== FALSE, 'Twig debug markup found in theme output when debug is enabled.'); + + // Disable debug, rebuild the service container, and clear all caches. + $this->settingsSet('twig_debug', FALSE); + $this->rebuildContainer(); + $this->resetAll(); + + $output = theme('theme_test_template_test'); + $this->assertFalse(strpos($output, '') !== FALSE, 'Twig debug markup not found in theme output when debug is disabled.'); + } + +}