function TwigSandboxTest::testTwigMethodAttributeNotAllowed
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php \Drupal\Tests\Core\Template\TwigSandboxTest::testTwigMethodAttributeNotAllowed()
Tests that method without TwigAllowed attribute is not allowed.
File
-
core/
tests/ Drupal/ Tests/ Core/ Template/ TwigSandboxTest.php, line 172
Class
- TwigSandboxTest
- Tests the twig sandbox policy.
Namespace
Drupal\Tests\Core\TemplateCode
public function testTwigMethodAttributeNotAllowed() : void {
$object = new AttributeAllowTestClass();
$this->expectException(SecurityError::class);
$this->twig
->render('{{ object.notAllowed() }}', [
'object' => $object,
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.