14
14
use PHPUnit \Framework \TestCase ;
15
15
use Symfony \Component \Validator \Constraint ;
16
16
use Symfony \Component \Validator \ConstraintValidator ;
17
+ use Symfony \Component \Validator \Tests \Fixtures \TestEnum ;
17
18
18
19
class ConstraintValidatorTest extends TestCase
19
20
{
@@ -41,14 +42,17 @@ public static function formatValueProvider()
41
42
['array ' , []],
42
43
['object ' , $ toString = new TestToStringObject ()],
43
44
['ccc ' , $ toString , ConstraintValidator::OBJECT_TO_STRING ],
44
- ['FirstCase ' , $ toString = TestEnum::FirstCase],
45
45
['object ' , $ dateTime = new \DateTimeImmutable ('1971-02-02T08:00:00UTC ' )],
46
46
[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 ],
47
47
[class_exists (\IntlDateFormatter::class) ? 'Feb 2, 1971, 8:00 AM ' : '1971-02-02 08:00:00 ' , $ dateTime , ConstraintValidator::PRETTY_DATE ],
48
48
[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 ],
49
49
[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 ],
50
50
];
51
51
52
+ if (\PHP_VERSION_ID >= 80100 ) {
53
+ $ data [] = ['FirstCase ' , TestEnum::FirstCase];
54
+ }
55
+
52
56
date_default_timezone_set ($ defaultTimezone );
53
57
54
58
return $ data ;
@@ -74,9 +78,3 @@ public function __toString()
74
78
return 'ccc ' ;
75
79
}
76
80
}
77
-
78
- enum TestEnum
79
- {
80
- case FirstCase;
81
- case SecondCase;
82
- }
0 commit comments