From 56bd932ba8ef367376fa3d62b2b0f22d64987779 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 2 Mar 2025 15:41:56 +0100 Subject: [PATCH] fix test setup and skip test until bug is fixed in PHP --- .../Tests/Constraints/Fixtures/WhenTestWithClosure.php | 3 ++- .../Component/Validator/Tests/Constraints/WhenTest.php | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Validator/Tests/Constraints/Fixtures/WhenTestWithClosure.php b/src/Symfony/Component/Validator/Tests/Constraints/Fixtures/WhenTestWithClosure.php index 56777ac7ae314..de0f07daa8e09 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/Fixtures/WhenTestWithClosure.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/Fixtures/WhenTestWithClosure.php @@ -11,13 +11,14 @@ namespace Symfony\Component\Validator\Tests\Constraints\Fixtures; +use Symfony\Component\Validator\Constraints\Callback; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotNull; use Symfony\Component\Validator\Constraints\When; #[When(expression: static function () { return true; - }, constraints: new NotNull() + }, constraints: new Callback('isValid') )] class WhenTestWithClosure { diff --git a/src/Symfony/Component/Validator/Tests/Constraints/WhenTest.php b/src/Symfony/Component/Validator/Tests/Constraints/WhenTest.php index a7dea114d404e..4435dd88e26fa 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/WhenTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/WhenTest.php @@ -118,6 +118,8 @@ public function testAttributes() */ public function testAttributesWithClosure() { + $this->markTestSkipped('Requires https://github.com/php/php-src/issues/17851 to be fixed'); + $loader = new AttributeLoader(); $metadata = new ClassMetadata(WhenTestWithClosure::class); @@ -129,7 +131,7 @@ public function testAttributesWithClosure() self::assertInstanceOf(\Closure::class, $classConstraint->expression); self::assertEquals([ new Callback( - callback: 'callback', + callback: 'isValid', groups: ['Default', 'WhenTestWithClosure'], ), ], $classConstraint->constraints);