Fix deprecation notices in tests

This commit is contained in:
Fabien Potencier
2026-05-24 09:47:09 +02:00
parent 475fb690ac
commit e3f66654b8
+14
View File
@@ -1208,10 +1208,14 @@ EOF
}
/**
* @group legacy
*
* @dataProvider getStringableTraversableBypassTemplates
*/
public function testSourcePolicySandboxBlocksToStringInStringableTraversable(string $template)
{
$this->expectDeprecation('Since twig/twig 3.27.0: The "Twig\Sandbox\SourcePolicyInterface" interface is deprecated with no replacement, do not pass an instance to "Twig\Extension\SandboxExtension".');
$sourcePolicy = new class implements SourcePolicyInterface {
public function enableSandbox(Source $source): bool
{
@@ -1289,8 +1293,13 @@ EOF
yield 'spread' => ['{{ ["a", ...obj]|join(",") }}'];
}
/**
* @group legacy
*/
public function testSourcePolicySandboxBlocksToStringInTraversableJoin()
{
$this->expectDeprecation('Since twig/twig 3.27.0: The "Twig\Sandbox\SourcePolicyInterface" interface is deprecated with no replacement, do not pass an instance to "Twig\Extension\SandboxExtension".');
$sourcePolicy = new class implements SourcePolicyInterface {
public function enableSandbox(Source $source): bool
{
@@ -1309,8 +1318,13 @@ EOF
}
}
/**
* @group legacy
*/
public function testSourcePolicySandboxBlocksToStringInTraversableReplace()
{
$this->expectDeprecation('Since twig/twig 3.27.0: The "Twig\Sandbox\SourcePolicyInterface" interface is deprecated with no replacement, do not pass an instance to "Twig\Extension\SandboxExtension".');
$sourcePolicy = new class implements SourcePolicyInterface {
public function enableSandbox(Source $source): bool
{