From afbaa2a9daeb7943666cbfa876dcd751d7dfee17 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 24 May 2026 11:16:20 +0200 Subject: [PATCH] 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. --- tests/Extension/SandboxTest.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/Extension/SandboxTest.php b/tests/Extension/SandboxTest.php index fe4397cda..45770e25e 100644 --- a/tests/Extension/SandboxTest.php +++ b/tests/Extension/SandboxTest.php @@ -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 {