1414use PHPUnit \Framework \TestCase ;
1515use Symfony \Component \Validator \Constraint ;
1616use Symfony \Component \Validator \ConstraintValidator ;
17+ use Symfony \Component \Validator \Tests \Fixtures \TestEnum ;
1718
1819class ConstraintValidatorTest extends TestCase
1920{
@@ -41,14 +42,17 @@ public static function formatValueProvider()
4142 ['array ' , []],
4243 ['object ' , $ toString = new TestToStringObject ()],
4344 ['ccc ' , $ toString , ConstraintValidator::OBJECT_TO_STRING ],
44- ['FirstCase ' , $ toString = TestEnum::FirstCase],
4545 ['object ' , $ dateTime = new \DateTimeImmutable ('1971-02-02T08:00:00UTC ' )],
4646 [class_exists (\IntlDateFormatter::class) ? 'Oct 4, 2019, 11:02 AM ' : '2019-10-04 11:02:03 ' , new \DateTimeImmutable ('2019-10-04T11:02:03+09:00 ' ), ConstraintValidator::PRETTY_DATE ],
4747 [class_exists (\IntlDateFormatter::class) ? 'Feb 2, 1971, 8:00 AM ' : '1971-02-02 08:00:00 ' , $ dateTime , ConstraintValidator::PRETTY_DATE ],
4848 [class_exists (\IntlDateFormatter::class) ? 'Jan 1, 1970, 6:00 AM ' : '1970-01-01 06:00:00 ' , new \DateTimeImmutable ('1970-01-01T06:00:00Z ' ), ConstraintValidator::PRETTY_DATE ],
4949 [class_exists (\IntlDateFormatter::class) ? 'Jan 1, 1970, 3:00 PM ' : '1970-01-01 15:00:00 ' , (new \DateTimeImmutable ('1970-01-01T23:00:00 ' ))->setTimezone (new \DateTimeZone ('America/New_York ' )), ConstraintValidator::PRETTY_DATE ],
5050 ];
5151
52+ if (\PHP_VERSION_ID >= 80100 ) {
53+ $ data [] = ['FirstCase ' , TestEnum::FirstCase];
54+ }
55+
5256 date_default_timezone_set ($ defaultTimezone );
5357
5458 return $ data ;
@@ -74,9 +78,3 @@ public function __toString()
7478 return 'ccc ' ;
7579 }
7680}
77-
78- enum TestEnum
79- {
80- case FirstCase;
81- case SecondCase;
82- }
0 commit comments