function TwigNamespaceTest::testTwigNamespaces
Same name in other branches
- 9 core/modules/system/tests/src/Kernel/Theme/TwigNamespaceTest.php \Drupal\Tests\system\Kernel\Theme\TwigNamespaceTest::testTwigNamespaces()
- 8.9.x core/modules/system/tests/src/Kernel/Theme/TwigNamespaceTest.php \Drupal\Tests\system\Kernel\Theme\TwigNamespaceTest::testTwigNamespaces()
- 11.x 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 64
Class
- TwigNamespaceTest
- Tests Twig namespaces.
Namespace
Drupal\Tests\system\Kernel\ThemeCode
public function testTwigNamespaces() : void {
// 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');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.