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