Allow access of twig sandbox to a few more extensions and functions

This commit is contained in:
Jan Böhmer 2024-03-06 20:21:07 +01:00
parent 1da3225e1d
commit 757201cafa
2 changed files with 32 additions and 9 deletions

View file

@ -53,7 +53,7 @@ use Twig\Sandbox\SecurityError;
class SandboxedTwigFactoryTest extends WebTestCase
{
private ?object $service = null;
private ?SandboxedTwigFactory $service = null;
protected function setUp(): void
{
@ -86,6 +86,9 @@ class SandboxedTwigFactoryTest extends WebTestCase
['
{{ part.reviewNeeded }} {{ part.tags }} {{ part.mass }}
'],
['
{{ entity_type(part) is object }}
']
];
}
@ -110,7 +113,7 @@ class SandboxedTwigFactoryTest extends WebTestCase
$options->setLines($twig);
$options->setProcessMode(LabelProcessMode::TWIG);
$twig = $this->service->getTwig($options);
$twig = $this->service->createTwig($options);
$str = $twig->render('lines', [
'part' => new Part(),
'lot' => new PartLot(),
@ -132,7 +135,7 @@ class SandboxedTwigFactoryTest extends WebTestCase
$options->setLines($twig);
$options->setProcessMode(LabelProcessMode::TWIG);
$twig = $this->service->getTwig($options);
$twig = $this->service->createTwig($options);
$str = $twig->render('lines', [
'part' => new Part(),
'lot' => new PartLot(),