@@ -22,12 +22,17 @@ final class ConstraintValidatorTest extends TestCase
2222 */
2323public function testFormatValue ($ expected ,$ value ,$ format =0 )
2424 {
25+ $ default =date_default_timezone_get ();
26+ date_default_timezone_set ('Europe/Moscow ' );
27+
2528$ this ->assertSame ($ expected , (new TestFormatValueConstraintValidator ())->formatValueProxy ($ value ,$ format ));
29+
30+ date_default_timezone_set ($ default );
2631 }
2732
2833public function formatValueProvider ()
2934 {
30- $ data = [
35+ return [
3136 ['true ' ,true ],
3237 ['false ' ,false ],
3338 ['null ' ,null ],
@@ -36,11 +41,11 @@ public function formatValueProvider()
3641 ['array ' , []],
3742 ['object ' ,$ toString =new TestToStringObject ()],
3843 ['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 ],
44+ ['object ' ,$ dateTime = (new \DateTimeImmutable ('1971-02-02T08:00:00 ' ))->setTimezone (new \DateTimeZone ('UTC ' ))],
45+ [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 ],
46+ [class_exists (\IntlDateFormatter::class) ?'Feb 2, 1971, 8:00 AM ' :'1971-02-02 08:00:00 ' ,$ dateTime , ConstraintValidator::PRETTY_DATE ],
47+ [class_exists (\IntlDateFormatter::class) ?'Jan 1, 1970, 6:00 AM ' :'1970-01-01 6:00:00 ' , (new \DateTimeImmutable ('1970-01-01T06:00:00 ' ))->setTimezone (new \DateTimeZone ('Z ' )), ConstraintValidator::PRETTY_DATE ],
4148 ];
42-
43- return $ data ;
4449 }
4550}
4651