function TwigExtensionTest::testEscaping
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php \Drupal\Tests\Core\Template\TwigExtensionTest::testEscaping()
- 10 core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php \Drupal\Tests\Core\Template\TwigExtensionTest::testEscaping()
- 11.x core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php \Drupal\Tests\Core\Template\TwigExtensionTest::testEscaping()
Tests the escaping
@dataProvider providerTestEscaping
File
-
core/
tests/ Drupal/ Tests/ Core/ Template/ TwigExtensionTest.php, line 77
Class
- TwigExtensionTest
- Tests the twig extension.
Namespace
Drupal\Tests\Core\TemplateCode
public function testEscaping($template, $expected) {
$loader = new \Twig_Loader_Filesystem();
$twig = new \Twig_Environment($loader, [
'debug' => TRUE,
'cache' => FALSE,
'autoescape' => 'html',
'optimizations' => 0,
]);
$twig->addExtension($this->systemUnderTest);
$name = '__string_template_test__';
$nodes = $twig->parse($twig->tokenize(new \Twig_Source($template, $name)));
$this->assertSame($expected, $nodes->getNode('body')
->getNode(0)
->getNode('expr') instanceof \Twig_Node_Expression_Filter);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.