function 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\Theme

Code

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.