public function TwigNamespaceTest::testTemplateDiscovery 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::testTemplateDiscovery()
Tests template discovery using namespaces.
File
- core/
modules/ system/ tests/ src/ Kernel/ Theme/ TwigNamespaceTest.php, line 48
Class
- TwigNamespaceTest
- Tests Twig namespaces.
Namespace
Drupal\Tests\system\Kernel\ThemeCode
public function testTemplateDiscovery() {
// Tests resolving namespaced templates in modules.
$this
->assertTwigTemplate($this->twig
->load('@node/node.html.twig'), 'Found node.html.twig in node module.');
// Tests resolving namespaced templates in themes.
$this
->assertTwigTemplate($this->twig
->load('@bartik/page.html.twig'), 'Found page.html.twig in Bartik theme.');
}