@@ -76,6 +76,7 @@ public function testFormat($pattern, $timestamp, $expected)
76
76
public function formatProvider ()
77
77
{
78
78
$ dateTime = new \DateTime ('@0 ' );
79
+ $ dateTimeImmutable = new \DateTimeImmutable ('@0 ' );
79
80
80
81
$ formatData = [
81
82
/* general */
@@ -250,6 +251,12 @@ public function formatProvider()
250
251
$ formatData [] = ['h:mm a ' , $ dateTime , '12:00 AM ' ];
251
252
$ formatData [] = ['yyyyy.MMMM.dd hh:mm aaa ' , $ dateTime , '01970.January.01 12:00 AM ' ];
252
253
254
+ /* general, DateTimeImmutable */
255
+ $ formatData [] = ['y-M-d ' , $ dateTimeImmutable , '1970-1-1 ' ];
256
+ $ formatData [] = ["EEE, MMM d, ''yy " , $ dateTimeImmutable , "Thu, Jan 1, '70 " ];
257
+ $ formatData [] = ['h:mm a ' , $ dateTimeImmutable , '12:00 AM ' ];
258
+ $ formatData [] = ['yyyyy.MMMM.dd hh:mm aaa ' , $ dateTimeImmutable , '01970.January.01 12:00 AM ' ];
259
+
253
260
if (IcuVersion::compare (Intl::getIcuVersion (), '59.1 ' , '>= ' , 1 )) {
254
261
// Before ICU 59.1 GMT was used instead of UTC
255
262
$ formatData [] = ["yyyy.MM.dd 'at' HH:mm:ss zzz " , 0 , '1970.01.01 at 00:00:00 UTC ' ];
@@ -269,6 +276,8 @@ public function testFormatUtcAndGmtAreSplit()
269
276
270
277
$ this ->assertSame ('1970.01.01 at 00:00:00 GMT ' , $ gmtFormatter ->format (new \DateTime ('@0 ' )));
271
278
$ this ->assertSame ('1970.01.01 at 00:00:00 UTC ' , $ utcFormatter ->format (new \DateTime ('@0 ' )));
279
+ $ this ->assertSame ('1970.01.01 at 00:00:00 GMT ' , $ gmtFormatter ->format (new \DateTimeImmutable ('@0 ' )));
280
+ $ this ->assertSame ('1970.01.01 at 00:00:00 UTC ' , $ utcFormatter ->format (new \DateTimeImmutable ('@0 ' )));
272
281
}
273
282
274
283
/**
0 commit comments