3 namespace Drupal\Tests\system\Functional\Theme;
5 use Drupal\Tests\BrowserTestBase;
8 * Tests adding Twig loaders.
12 class TwigLoaderTest extends BrowserTestBase {
19 public static $modules = ['twig_loader_test'];
22 * Tests adding an additional twig loader to the loader chain.
24 public function testTwigLoaderAddition() {
25 $environment = \Drupal::service('twig');
27 $template = $environment->loadTemplate('kittens');
28 $this->assertEqual($template->render([]), 'kittens', 'Passing "kittens" to the custom Twig loader returns "kittens".');
30 $template = $environment->loadTemplate('meow');
31 $this->assertEqual($template->render([]), 'cats', 'Passing something other than "kittens" to the custom Twig loader returns "cats".');