You are here

public function TwigNamespaceTest::testTemplateDiscovery in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Kernel/Theme/TwigNamespaceTest.php \Drupal\Tests\system\Kernel\Theme\TwigNamespaceTest::testTemplateDiscovery()
  2. 9 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 50

Class

TwigNamespaceTest
Tests Twig namespaces.

Namespace

Drupal\Tests\system\Kernel\Theme

Code

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('@olivero/layout/page.html.twig'), 'Found page.html.twig in Olivero theme.');
}