Skip to content

Commit 8a12ba7

Browse files
Ion Bazancs278
authored andcommitted
Add testcase for #30
hnw#31
1 parent cccc7b4 commit 8a12ba7

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/issue_030.phpt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
Check for issue #30 (DateTimeImmutable::createFromFormat with ! returns DateTime)
3+
--SKIPIF--
4+
<?php
5+
$required_version = "5.5";
6+
$required_func = array("timecop_freeze");
7+
$required_class = array("TimecopDateTimeImmutable");
8+
include(__DIR__."/tests-skipcheck.inc.php");
9+
--INI--
10+
date.timezone=GMT
11+
timecop.func_override=1
12+
--FILE--
13+
<?php
14+
$dt1 = \DateTimeImmutable::createFromFormat('!Y-m-d', '2017-10-03');
15+
$dt2 = \DateTimeImmutable::createFromFormat('!Y-m-d', '2017-10-03');
16+
var_dump(get_class($dt1));
17+
var_dump($dt1->format('c'));
18+
var_dump(get_class($dt2));
19+
var_dump($dt2->format('c'));
20+
--EXPECT--
21+
string(17) "DateTimeImmutable"
22+
string(25) "2017-10-03T00:00:00+00:00"
23+
string(17) "DateTimeImmutable"
24+
string(25) "2017-10-03T00:00:00+00:00"

0 commit comments

Comments
 (0)