Mark new SourcePolicyInterface column filter tests as @group legacy

These tests pass a SourcePolicyInterface instance to SandboxExtension, which
triggers the 3.27 deprecation. Mark them legacy and assert the deprecation
to silence the PHPUnit "unhandled deprecation" report.
This commit is contained in:
Fabien Potencier
2026-05-24 11:16:20 +02:00
parent 09c6706407
commit afbaa2a9da
+20
View File
@@ -1173,8 +1173,13 @@ EOF
$this->assertSame('bar', $twig->load('index')->render($params));
}
/**
* @group legacy
*/
public function testSourcePolicySandboxBlocksColumnFilterOnDisallowedProperty()
{
$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
{
@@ -1194,8 +1199,13 @@ EOF
}
}
/**
* @group legacy
*/
public function testSourcePolicySandboxBlocksColumnFilterOnDisallowedIndex()
{
$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
{
@@ -1215,8 +1225,13 @@ EOF
}
}
/**
* @group legacy
*/
public function testSourcePolicySandboxAllowsColumnFilterOnAllowedProperty()
{
$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
{
@@ -1230,8 +1245,13 @@ EOF
$this->assertSame('bar', $twig->load('index')->render($params));
}
/**
* @group legacy
*/
public function testSourcePolicySandboxBlocksColumnFilterOnMagicGetter()
{
$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
{