@@ -123,10 +123,8 @@ public function formatProvider()
123
123
$ formatData = array (
124
124
/* general */
125
125
array ('y-M-d ' , 0 , '1970-1-1 ' ),
126
- array ("yyyy.MM.dd 'at' HH:mm:ss zzz " , 0 , '1970.01.01 at 00:00:00 GMT+00:00 ' ),
127
126
array ("EEE, MMM d, ''yy " , 0 , "Thu, Jan 1, '70 " ),
128
127
array ('h:mm a ' , 0 , '12:00 AM ' ),
129
- array ('K:mm a, z ' , 0 , '0:00 AM, GMT+00:00 ' ),
130
128
array ('yyyyy.MMMM.dd hh:mm aaa ' , 0 , '01970.January.01 12:00 AM ' ),
131
129
132
130
/* escaping */
@@ -287,26 +285,36 @@ public function formatProvider()
287
285
array ('s ' , 3601 , '1 ' ),
288
286
array ('s ' , 3630 , '30 ' ),
289
287
array ('s ' , 43200 , '0 ' ), // 12 hours
290
-
291
- /* timezone */
292
- array ('z ' , 0 , 'GMT+00:00 ' ),
293
- array ('zz ' , 0 , 'GMT+00:00 ' ),
294
- array ('zzz ' , 0 , 'GMT+00:00 ' ),
295
- array ('zzzz ' , 0 , 'GMT+00:00 ' ),
296
- array ('zzzzz ' , 0 , 'GMT+00:00 ' ),
297
288
);
298
289
290
+ // Timezone
291
+ if (!$ this ->isIntlExtensionLoaded () || $ this ->isLowerThanIcuVersion ('4.8 ' )) {
292
+ // general
293
+ $ formatData [] = array ("yyyy.MM.dd 'at' HH:mm:ss zzz " , 0 , '1970.01.01 at 00:00:00 GMT+00:00 ' );
294
+ $ formatData [] = array ('K:mm a, z ' , 0 , '0:00 AM, GMT+00:00 ' );
295
+
296
+ // timezone
297
+ $ formatData [] = array ('z ' , 0 , 'GMT+00:00 ' );
298
+ $ formatData [] = array ('zz ' , 0 , 'GMT+00:00 ' );
299
+ $ formatData [] = array ('zzz ' , 0 , 'GMT+00:00 ' );
300
+ $ formatData [] = array ('zzzz ' , 0 , 'GMT+00:00 ' );
301
+ $ formatData [] = array ('zzzzz ' , 0 , 'GMT+00:00 ' );
302
+ }
303
+
299
304
// As of PHP 5.3.4, IntlDateFormatter::format() accepts DateTime instances
300
305
if ($ this ->isGreaterOrEqualThanPhpVersion ('5.3.4 ' )) {
301
306
$ dateTime = new \DateTime ('@0 ' );
302
307
303
308
/* general, DateTime */
304
309
$ formatData [] = array ('y-M-d ' , $ dateTime , '1970-1-1 ' );
305
- $ formatData [] = array ("yyyy.MM.dd 'at' HH:mm:ss zzz " , $ dateTime , '1970.01.01 at 00:00:00 GMT+00:00 ' );
306
310
$ formatData [] = array ("EEE, MMM d, ''yy " , $ dateTime , "Thu, Jan 1, '70 " );
307
311
$ formatData [] = array ('h:mm a ' , $ dateTime , '12:00 AM ' );
308
- $ formatData [] = array ('K:mm a, z ' , $ dateTime , '0:00 AM, GMT+00:00 ' );
309
312
$ formatData [] = array ('yyyyy.MMMM.dd hh:mm aaa ' , $ dateTime , '01970.January.01 12:00 AM ' );
313
+
314
+ if (!$ this ->isIntlExtensionLoaded () || $ this ->isLowerThanIcuVersion ('4.8 ' )) {
315
+ $ formatData [] = array ("yyyy.MM.dd 'at' HH:mm:ss zzz " , $ dateTime , '1970.01.01 at 00:00:00 GMT+00:00 ' );
316
+ $ formatData [] = array ('K:mm a, z ' , $ dateTime , '0:00 AM, GMT+00:00 ' );
317
+ }
310
318
}
311
319
312
320
return $ formatData ;
@@ -430,7 +438,9 @@ public function testFormatWithTimezoneFormatOptionAndDifferentThanUtcIntl()
430
438
$ this ->skipIfIntlExtensionIsNotLoaded ();
431
439
$ formatter = $ this ->createIntlFormatter ('zzzz ' );
432
440
$ formatter ->setTimeZoneId ('Pacific/Fiji ' );
433
- $ this ->assertEquals ('Fiji Time ' , $ formatter ->format (0 ));
441
+
442
+ $ expected = $ this ->isGreaterOrEqualThanIcuVersion ('49 ' ) ? 'Fiji Standard Time ' : 'Fiji Time ' ;
443
+ $ this ->assertEquals ($ expected , $ formatter ->format (0 ));
434
444
}
435
445
436
446
public function testFormatWithGmtTimezoneStub ()
@@ -464,7 +474,7 @@ public function testFormatWithDefaultTimezoneIntl()
464
474
$ this ->skipIfIntlExtensionIsNotLoaded ();
465
475
$ this ->skipIfICUVersionIsTooOld ();
466
476
467
- $ formatter = new \IntlDateFormatter ('en ' , StubIntlDateFormatter::MEDIUM
10000
span>, StubIntlDateFormatter::SHORT );
477
+ $ formatter = new \IntlDateFormatter ('en ' , StubIntlDateFormatter::MEDIUM , StubIntlDateFormatter::SHORT , ' UTC ' );
468
478
$ formatter ->setPattern ('yyyy-MM-dd HH:mm:ss ' );
469
479
470
480
$ this ->assertEquals (
@@ -493,7 +503,7 @@ public function testFormatWithDefaultTimezoneStubShouldUseTheTzEnvironmentVariab
493
503
}
494
504
495
505
/**
496
- * It seems IntlDateFormatter caches the timezone id when not explicitely set via constructor or by the
506
+ * It seems IntlDateFormatter caches the timezone id when not explicitly set via constructor or by the
497
507
* setTimeZoneId() method. Since testFormatWithDefaultTimezoneIntl() runs using the default environment
498
508
* time zone, this test would use it too if not running in a separated process.
499
509
*
@@ -561,17 +571,21 @@ public function testDateAndTimeTypeIntl($timestamp, $datetype, $timetype, $expec
561
571
562
572
public function dateAndTimeTypeProvider ()
563
573
{
564
- return array (
574
+ $ data = array (
565
575
array (0 , StubIntlDateFormatter::FULL , StubIntlDateFormatter::NONE , 'Thursday, January 1, 1970 ' ),
566
576
array (0 , StubIntlDateFormatter::LONG , StubIntlDateFormatter::NONE , 'January 1, 1970 ' ),
567
577
array (0 , StubIntlDateFormatter::MEDIUM , StubIntlDateFormatter::NONE , 'Jan 1, 1970 ' ),
568
578
array (0 , StubIntlDateFormatter::SHORT , StubIntlDateFormatter::NONE , '1/1/70 ' ),
569
-
570
- array (0 , StubIntlDateFormatter::NONE , StubIntlDateFormatter::FULL , '12:00:00 AM GMT+00:00 ' ),
571
- array (0 , StubIntlDateFormatter::NONE , StubIntlDateFormatter::LONG , '12:00:00 AM GMT+00:00 ' ),
572
579
array (0 , StubIntlDateFormatter::NONE , StubIntlDateFormatter::MEDIUM , '12:00:00 AM ' ),
573
580
array (0 , StubIntlDateFormatter::NONE , StubIntlDateFormatter::SHORT , '12:00 AM ' ),
574
581
);
582
+
583
+ if (!$ this ->isIntlExtensionLoaded () || $ this ->isLowerThanIcuVersion ('4.8 ' )) {
584
+ $ data [] = array (0 , StubIntlDateFormatter::NONE , StubIntlDateFormatter::FULL , '12:00:00 AM GMT+00:00 ' );
585
+ $ data [] = array (0 , StubIntlDateFormatter::NONE , StubIntlDateFormatter::LONG , '12:00:00 AM GMT+00:00 ' );
586
+ }
587
+
588
+ return $ data ;
575
589
}
576
590
577
591
public function testGetCalendar ()
@@ -847,10 +861,7 @@ public function testParseErrorStub($pattern, $value)
847
861
848
862
public function parseErrorProvider ()
849
863
{
850
- return array (
851
- array ('y-M-d ' , '1970/1/1 ' ),
852
- array ('yy-M-d ' , '70/1/1 ' ),
853
-
864
+ $ data = array (
854
865
// 1 char month
855
866
array ('y-MMMMM-d ' , '1970-J-1 ' ),
856
867
array ('y-MMMMM-d ' , '1970-S-1 ' ),
@@ -859,6 +870,13 @@ public function parseErrorProvider()
859
870
array ('y-LLLLL-d ' , '1970-J-1 ' ),
860
871
array ('y-LLLLL-d ' , '1970-S-1 ' ),
861
872
);
873
+
874
+ if (!$ this ->isIntlExtensionLoaded () || $ this ->isLowerThanIcuVersion ('4.8 ' )) {
875
+ $ data [] = array ('y-M-d ' , '1970/1/1 ' );
876
+ $ data [] = array ('yy-M-d ' , '70/1/1 ' );
877
+ }
878
+
879
+ return $ data ;
862
880
}
863
881
864
882
/**
0 commit comments