Skip to content
Snippets Groups Projects

Added overridden Keyword

Closed sumit kumar requested to merge issue/drupal-3420709:3420709-make-it-more into 11.x
1 unresolved thread
Files
3
@@ -53,18 +53,18 @@ public function testTwigDebugMarkup() {
$output = (string) $renderer->renderRoot($build);
$this->assertStringContainsString('<!-- THEME DEBUG -->', $output, 'Twig debug markup found in theme output when debug is enabled.');
$this->assertStringContainsString("THEME HOOK: 'node'", $output, 'Theme call information found.');
$this->assertStringContainsString('* node--1--full' . $extension . PHP_EOL . ' x node--1' . $extension . PHP_EOL . ' * node--page--full' . $extension . PHP_EOL . ' * node--page' . $extension . PHP_EOL . ' * node--full' . $extension . PHP_EOL . ' * node' . $extension, $output, 'Suggested template files found in order and node ID specific template shown as current template.');
$this->assertStringContainsString('▪️ node--1--full' . $extension . PHP_EOL . ' node--1' . $extension . PHP_EOL . ' ▪️ node--page--full' . $extension . PHP_EOL . ' ▪️ node--page' . $extension . PHP_EOL . ' ▪️ node--full' . $extension . PHP_EOL . ' ▪️ node' . $extension, $output, 'Suggested template files found in order and node ID specific template shown as current template.');
$this->assertStringContainsString(Html::escape('node--<script type="text/javascript">alert(\'yo\');</script>'), (string) $output);
$this->assertStringContainsString('<!-- INVALID FILE NAME SUGGESTIONS:' . PHP_EOL . ' See https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Render!theme.api.php/function/hook_theme_suggestions_alter' . PHP_EOL . ' invalid_theme_suggestions' . PHP_EOL . '-->', $output, 'Twig debug markup found invalid suggestions.');
$template_filename = $templates['node__1']['path'] . '/' . $templates['node__1']['template'] . $extension;
$this->assertStringContainsString("BEGIN OUTPUT from '$template_filename'", $output, 'Full path to current template file found.');
$this->assertStringContainsString("💡 BEGIN CUSTOM TEMPLATE OUTPUT from '$template_filename'", $output, 'Full path to current template file found.');
// Create another node and make sure the template suggestions shown in the
// debug markup are correct.
$node2 = $this->drupalCreateNode();
$build = $builder->view($node2);
$output = (string) $renderer->renderRoot($build);
$this->assertStringContainsString('* node--2--full' . $extension . PHP_EOL . ' * node--2' . $extension . PHP_EOL . ' * node--page--full' . $extension . PHP_EOL . ' * node--page' . $extension . PHP_EOL . ' * node--full' . $extension . PHP_EOL . ' x node' . $extension, $output, 'Suggested template files found in order and base template shown as current template.');
$this->assertStringContainsString('▪️ node--2--full' . $extension . PHP_EOL . ' ▪️ node--2' . $extension . PHP_EOL . ' ▪️ node--page--full' . $extension . PHP_EOL . ' ▪️ node--page' . $extension . PHP_EOL . ' ▪️ node--full' . $extension . PHP_EOL . ' node' . $extension, $output, '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.
@@ -73,7 +73,7 @@ public function testTwigDebugMarkup() {
$build += $builder->view($node3);
$output = (string) $renderer->renderRoot($build);
$this->assertStringContainsString("THEME HOOK: 'node__foo__bar'", $output, 'Theme call information found.');
$this->assertStringContainsString('* node--foo--bar' . $extension . PHP_EOL . ' * node--foo' . $extension . PHP_EOL . ' * node--&lt;script type=&quot;text/javascript&quot;&gt;alert(&#039;yo&#039;);&lt;/script&gt;' . $extension . PHP_EOL . ' * node--3--full' . $extension . PHP_EOL . ' * node--3' . $extension . PHP_EOL . ' * node--page--full' . $extension . PHP_EOL . ' * node--page' . $extension . PHP_EOL . ' * node--full' . $extension . PHP_EOL . ' x node' . $extension, $output, 'Suggested template files found in order and base template shown as current template.');
$this->assertStringContainsString('▪️ node--foo--bar' . $extension . PHP_EOL . ' ▪️ node--foo' . $extension . PHP_EOL . ' ▪️ node--&lt;script type=&quot;text/javascript&quot;&gt;alert(&#039;yo&#039;);&lt;/script&gt;' . $extension . PHP_EOL . ' ▪️ node--3--full' . $extension . PHP_EOL . ' ▪️ node--3' . $extension . PHP_EOL . ' ▪️ node--page--full' . $extension . PHP_EOL . ' ▪️ node--page' . $extension . PHP_EOL . ' ▪️ node--full' . $extension . PHP_EOL . ' node' . $extension, $output, 'Suggested template files found in order and base template shown as current template.');
// Disable debug, rebuild the service container, and clear all caches.
$parameters = $this->container->getParameter('twig.config');
Loading