Skip to content

Commit 46f22ac

Browse files
committed
Adding a new test for the new method
1 parent 42660f3 commit 46f22ac

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
Tests for DateTime::createFromImmutable.
3+
--INI--
4+
date.timezone=America/New_York
5+
--FILE--
6+
<?php
7+
$current = "2015-03-05 07:00:16";
8+
9+
$i = DateTime::createFromImmutable(date_create_immutable($current));
10+
var_dump($i);
11+
12+
$i = DateTime::createFromImmutable(date_create($current));
13+
var_dump($i);
14+
?>
15+
--EXPECTF--
16+
object(DateTime)#%d (3) {
17+
["date"]=>
18+
string(26) "2015-03-05 07:00:16.000000"
19+
["timezone_type"]=>
20+
int(3)
21+
["timezone"]=>
22+
string(13) "America/New_York"
23+
}
24+
25+
Warning: DateTime::createFromImmutable() expects parameter 1 to be DateTimeImmutable, object given in %stests%eDateTime_createFromImmutable.php on line %d
26+
NULL

0 commit comments

Comments
 (0)