public function TwigNamespaceTest::testTwigNamespaces in Drupal 9
Same name and namespace in other branches
- 8 core/modules/system/tests/src/Kernel/Theme/TwigNamespaceTest.php \Drupal\Tests\system\Kernel\Theme\TwigNamespaceTest::testTwigNamespaces()
Tests template extension and includes using namespaces.
File
- core/modules/ system/ tests/ src/ Kernel/ Theme/ TwigNamespaceTest.php, line 59 
Class
- TwigNamespaceTest
- Tests Twig namespaces.
Namespace
Drupal\Tests\system\Kernel\ThemeCode
public function testTwigNamespaces() {
  // Test twig @extends and @include in template files.
  $test = [
    '#theme' => 'twig_namespace_test',
  ];
  $this
    ->setRawContent(\Drupal::service('renderer')
    ->renderRoot($test));
  $this
    ->assertText('This line is from twig_namespace_a/templates/test.html.twig');
  $this
    ->assertText('This line is from twig_namespace_b/templates/test.html.twig');
}