
| Current Path : /var/www/html/dataninja.cn/core/modules/system/tests/src/Functional/Theme/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/dataninja.cn/core/modules/system/tests/src/Functional/Theme/TwigLoaderTest.php |
<?php
namespace Drupal\Tests\system\Functional\Theme;
use Drupal\Tests\BrowserTestBase;
/**
* Tests adding Twig loaders.
*
* @group Theme
*/
class TwigLoaderTest extends BrowserTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['twig_loader_test'];
/**
* Tests adding an additional twig loader to the loader chain.
*/
public function testTwigLoaderAddition() {
$environment = \Drupal::service('twig');
$template = $environment->loadTemplate('kittens');
$this->assertEqual($template->render([]), 'kittens', 'Passing "kittens" to the custom Twig loader returns "kittens".');
$template = $environment->loadTemplate('meow');
$this->assertEqual($template->render([]), 'cats', 'Passing something other than "kittens" to the custom Twig loader returns "cats".');
}
}