@@ -27,6 +27,9 @@ public function testFormatValue($expected, $value, $format = 0)
27
27
28
28
public function formatValueProvider ()
29
29
{
30
+ $ defaultTimezone = date_default_timezone_get ();
31
+ date_default_timezone_set ('Europe/Moscow ' ); // GMT+3
32
+
30
33
$ data = [
31
34
['true ' , true ],
32
35
['false ' , false ],
@@ -36,10 +39,15 @@ public function formatValueProvider()
36
39
['array ' , []],
37
40
['object ' , $ toString = new TestToStringObject ()],
38
41
['ccc ' , $ toString , ConstraintValidator::OBJECT_TO_STRING ],
39
- ['object ' , $ dateTime = (new \DateTimeImmutable ('@0 ' ))->setTimezone (new \DateTimeZone ('UTC ' ))],
40
- [class_exists (\IntlDateFormatter::class) ? 'Jan 1, 1970, 12:00 AM ' : '1970-01-01 00:00:00 ' , $ dateTime , ConstraintValidator::PRETTY_DATE ],
42
+ ['object ' , $ dateTime = new \DateTimeImmutable ('1971-02-02T08:00:00UTC ' )],
43
+ [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 ],
44
+ [class_exists (\IntlDateFormatter::class) ? 'Feb 2, 1971, 8:00 AM ' : '1971-02-02 08:00:00 ' , $ dateTime , ConstraintValidator::PRETTY_DATE ],
45
+ [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 ],
46
+ [class_exists (\IntlDateFormatter::class) ? 'Jan 1, 1970, 6:00 PM ' : '1970-01-01 18:00:00 ' , (new \DateTimeImmutable ('1970-01-01T23:00:00 ' ))->setTimezone (new \DateTimeZone ('-02:00 ' )), ConstraintValidator::PRETTY_DATE ],
41
47
];
42
48
49
+ date_default_timezone_set ($ defaultTimezone );
50
+
43
51
return $ data ;
44
52
}
45
53
}
0 commit comments