function TwigNamespaceTest::testTemplateDiscovery

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

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.