You are here

public function TwigNamespaceTest::testTemplateDiscovery in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Theme/TwigNamespaceTest.php \Drupal\system\Tests\Theme\TwigNamespaceTest::testTemplateDiscovery()

Tests template discovery using namespaces.

File

core/modules/system/src/Tests/Theme/TwigNamespaceTest.php, line 47
Contains \Drupal\system\Tests\Theme\TwigNamespaceTest.

Class

TwigNamespaceTest
Tests Twig namespaces.

Namespace

Drupal\system\Tests\Theme

Code

public function testTemplateDiscovery() {

  // Tests resolving namespaced templates in modules.
  $this
    ->assertTwigTemplate($this->twig
    ->resolveTemplate('@node/node.html.twig'), 'Found node.html.twig in node module.');

  // Tests resolving namespaced templates in themes.
  $this
    ->assertTwigTemplate($this->twig
    ->resolveTemplate('@bartik/page.html.twig'), 'Found page.html.twig in Bartik theme.');
}