@@ -76,6 +76,7 @@ public function testFormat($pattern, $timestamp, $expected)
7676 public function formatProvider ()
7777 {
7878 $ dateTime = new \DateTime ('@0 ' );
79+ $ dateTimeImmutable = new \DateTimeImmutable ('@0 ' );
7980
8081 $ formatData = [
8182 /* general */
@@ -250,6 +251,12 @@ public function formatProvider()
250251 $ formatData [] = ['h:mm a ' , $ dateTime , '12:00 AM ' ];
251252 $ formatData [] = ['yyyyy.MMMM.dd hh:mm aaa ' , $ dateTime , '01970.January.01 12:00 AM ' ];
252253
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+
253260 if (IcuVersion::compare (Intl::getIcuVersion (), '59.1 ' , '>= ' , 1 )) {
254261 // Before ICU 59.1 GMT was used instead of UTC
255262 $ formatData [] = ["yyyy.MM.dd 'at' HH:mm:ss zzz " , 0 , '1970.01.01 at 00:00:00 UTC ' ];
@@ -272,6 +279,8 @@ public function testFormatUtcAndGmtAreSplit()
272279
273280 $ this ->assertSame ('1970.01.01 at 00:00:00 GMT ' , $ gmtFormatter ->format (new \DateTime ('@0 ' )));
274281 $ this ->assertSame ('1970.01.01 at 00:00:00 UTC ' , $ utcFormatter ->format (new \DateTime ('@0 ' )));
282+ $ this ->assertSame ('1970.01.01 at 00:00:00 GMT ' , $ gmtFormatter ->format (new \DateTimeImmutable ('@0 ' )));
283+ $ this ->assertSame ('1970.01.01 at 00:00:00 UTC ' , $ utcFormatter ->format (new \DateTimeImmutable ('@0 ' )));
275284 }
276285
277286 /**
0 commit comments