@@ -503,18 +503,18 @@ public function testFormatWithGmtTimezoneIntl()
503
503
$ this ->assertEquals ('GMT+03:00 ' , $ formatter ->format (0 ));
504
504
}
505
505
506
- public function testFormatWithDefaultTimezoneStub ()
506
+ public function testFormatWithConstructorTimezoneStub ()
507
507
{
508
- $ formatter = new StubIntlDateFormatter ('en ' , StubIntlDateFormatter::MEDIUM , StubIntlDateFormatter::SHORT );
508
+ $ formatter = new StubIntlDateFormatter ('en ' , StubIntlDateFormatter::MEDIUM , StubIntlDateFormatter::SHORT , ' UTC ' );
509
509
$ formatter ->setPattern ('yyyy-MM-dd HH:mm:ss ' );
510
510
511
511
$ this ->assertEquals (
512
- $ this ->createDateTime (0 )->format ('Y-m-d H:i:s ' ),
512
+ $ this ->createDateTime (0 , ' UTC ' )->format ('Y-m-d H:i:s ' ),
513
513
$ formatter ->format (0 )
514
514
);
515
515
}
516
516
517
- public function testFormatWithDefaultTimezoneIntl ()
517
+ public function testFormatWithConstructorTimezoneIntl ()
518
518
{
519
519
$ this ->skipIfIntlExtensionIsNotLoaded ();
520
520
$ this ->skipIfICUVersionIsTooOld ();
@@ -523,7 +523,7 @@ public function testFormatWithDefaultTimezoneIntl()
523
523
$ formatter ->setPattern ('yyyy-MM-dd HH:mm:ss ' );
524
524
525
525
$ this ->assertEquals (
526
- $ this ->createDateTime (0 )->format ('Y-m-d H:i:s ' ),
526
+ $ this ->createDateTime (0 , ' UTC ' )->format ('Y-m-d H:i:s ' ),
527
527
$ formatter ->format (0 )
528
528
);
529
529
}
@@ -541,7 +541,7 @@ public function testFormatWithDefaultTimezoneStubShouldUseTheTzEnvironmentVariab
541
541
$ formatter ->setPattern ('yyyy-MM-dd HH:mm:ss ' );
542
542
543
543
$ this ->assertEquals (
544
- $ this ->createDateTime (0 )->format ('Y-m-d H:i:s ' ),
544
+ $ this ->createDateTime (0 , ' Europe/London ' )->format ('Y-m-d H:i:s ' ),
545
545
$ formatter ->format (0 )
546
546
);
547
547
@@ -564,7 +564,7 @@ public function testFormatWithDefaultTimezoneStubShouldUseDefaultDateTimeZoneVar
564
564
$ formatter ->setPattern ('yyyy-MM-dd HH:mm:ss ' );
565
565
566
566
$ this ->assertEquals (
567
- $ this ->createDateTime (0 )->format ('Y-m-d H:i:s ' ),
567
+ $ this ->createDateTime (0 , ' Europe/London ' )->format ('Y-m-d H:i:s ' ),
568
568
$ formatter ->format (0 )
569
569
);
570
570
@@ -599,7 +599,7 @@ public function testFormatWithDefaultTimezoneIntlShouldUseTheTzEnvironmentVariab
599
599
$ this ->assertEquals ('Europe/Paris ' , getenv ('TZ ' ));
600
600
601
601
$ this ->assertEquals (
602
- $ this ->createDateTime (0 )->format ('Y-m-d H:i:s ' ),
602
+ $ this ->createDateTime (0 , ' Europe/Paris ' )->format ('Y-m-d H:i:s ' ),
603
603
$ formatter ->format (0 )
604
604
);
605
605
@@ -628,7 +628,7 @@ public function testFormatWithDefaultTimezoneIntlShouldUseDefaultDateTimeZoneVar
628
628
$ this ->assertEquals ('Europe/Paris ' , date_default_timezone_get ());
629
629
630
630
$ this ->assertEquals (
631
- $ this ->createDateTime (0 )->format ('Y-m-d H:i:s ' ),
631
+ $ this ->createDateTime (0 , ' Europe/Paris ' )->format ('Y-m-d H:i:s ' ),
632
632
$ formatter ->format (0 )
633
633
);
634
634
@@ -1223,13 +1223,8 @@ protected function createIntlFormatter($pattern = null)
1223
1223
return new \IntlDateFormatter ('en ' , \IntlDateFormatter::MEDIUM , \IntlDateFormatter::SHORT , 'UTC ' , \IntlDateFormatter::GREGORIAN , $ pattern );
1224
1224
}
1225
1225
1226
- protected function createDateTime ($ timestamp = null )
1226
+ protected function createDateTime ($ timestamp, $ timeZone )
1227
1227
{
1228
- if ($ this ->isGreaterOrEqualThanPhpVersion ('5.5.0-dev ' )) {
1229
- $ timeZone = date_default_timezone_get ();
1230
- } else {
1231
- $ timeZone = getenv ('TZ ' ) ?: 'UTC ' ;
1232
- }
1233
1228
1234
1229
$ dateTime = new \DateTime ();
1235
1230
$ dateTime ->setTimestamp (null === $ timestamp ? time () : $ timestamp );
0 commit comments