You are here

public function TwigNamespaceTest::testTwigNamespaces 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::testTwigNamespaces()

Tests template extension and includes using namespaces.

File

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

Class

TwigNamespaceTest
Tests Twig namespaces.

Namespace

Drupal\system\Tests\Theme

Code

public function testTwigNamespaces() {

  // Test twig @extends and @include in template files.
  $test = array(
    '#theme' => 'twig_namespace_test',
  );
  $this
    ->setRawContent(\Drupal::service('renderer')
    ->renderRoot($test));
  $this
    ->assertText('This line is from twig_namespace_a/templates/test.html.twig');
  $this
    ->assertText('This line is from twig_namespace_b/templates/test.html.twig');
}