function TwigSandboxTest::testEntityDangerousMethods
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php \Drupal\Tests\Core\Template\TwigSandboxTest::testEntityDangerousMethods()
- 10 core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php \Drupal\Tests\Core\Template\TwigSandboxTest::testEntityDangerousMethods()
- 9 core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php \Drupal\Tests\Core\Template\TwigSandboxTest::testEntityDangerousMethods()
- 8.9.x core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php \Drupal\Tests\Core\Template\TwigSandboxTest::testEntityDangerousMethods()
Tests that dangerous methods cannot be called in entity objects.
Attributes
#[DataProvider('getTwigEntityDangerousMethods')]
File
-
core/
tests/ Drupal/ Tests/ Core/ Template/ TwigSandboxTest.php, line 51
Class
- TwigSandboxTest
- Tests the twig sandbox policy.
Namespace
Drupal\Tests\Core\TemplateCode
public function testEntityDangerousMethods(string $template) : void {
$this->expectException(SecurityError::class);
$this->twig
->render($template, [
'entity' => $this->createStub(EntityInterface::class),
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.