function TwigSandboxTest::testEntityDangerousMethods
Tests that dangerous methods cannot be called in entity objects.
@dataProvider getTwigEntityDangerousMethods
File
-
core/
tests/ Drupal/ Tests/ Core/ Template/ TwigSandboxTest.php, line 52
Class
- TwigSandboxTest
- Tests the twig sandbox policy.
Namespace
Drupal\Tests\Core\TemplateCode
public function testEntityDangerousMethods($template) {
$entity = $this->createMock('Drupal\\Core\\Entity\\EntityInterface');
$this->expectException(SecurityError::class);
$this->twig
->render($template, [
'entity' => $entity,
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.