Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / modules / system / tests / src / Functional / Theme / TwigLoaderTest.php
1 <?php
2
3 namespace Drupal\Tests\system\Functional\Theme;
4
5 use Drupal\Tests\BrowserTestBase;
6
7 /**
8  * Tests adding Twig loaders.
9  *
10  * @group Theme
11  */
12 class TwigLoaderTest extends BrowserTestBase {
13
14   /**
15    * Modules to enable.
16    *
17    * @var array
18    */
19   public static $modules = ['twig_loader_test'];
20
21   /**
22    * Tests adding an additional twig loader to the loader chain.
23    */
24   public function testTwigLoaderAddition() {
25     $environment = \Drupal::service('twig');
26
27     $template = $environment->loadTemplate('kittens');
28     $this->assertEqual($template->render([]), 'kittens', 'Passing "kittens" to the custom Twig loader returns "kittens".');
29
30     $template = $environment->loadTemplate('meow');
31     $this->assertEqual($template->render([]), 'cats', 'Passing something other than "kittens" to the custom Twig loader returns "cats".');
32   }
33
34 }