public function TwigLoaderTest::testTwigLoaderAddition in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Theme/TwigLoaderTest.php \Drupal\system\Tests\Theme\TwigLoaderTest::testTwigLoaderAddition()
Tests adding an additional twig loader to the loader chain.
File
- core/
modules/ system/ src/ Tests/ Theme/ TwigLoaderTest.php, line 29 - Contains \Drupal\system\Tests\Theme\TwigLoaderTest.
Class
- TwigLoaderTest
- Tests adding Twig loaders.
Namespace
Drupal\system\Tests\ThemeCode
public function testTwigLoaderAddition() {
$environment = \Drupal::service('twig');
$template = $environment
->loadTemplate('kittens');
$this
->assertEqual($template
->render(array()), 'kittens', 'Passing "kittens" to the custom Twig loader returns "kittens".');
$template = $environment
->loadTemplate('meow');
$this
->assertEqual($template
->render(array()), 'cats', 'Passing something other than "kittens" to the custom Twig loader returns "cats".');
}