Skip to content

Commit

Permalink
Add testcase for #30
Browse files Browse the repository at this point in the history
  • Loading branch information
Ion Bazan authored and cs278 committed Jun 19, 2018
1 parent cccc7b4 commit 8a12ba7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/issue_030.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--TEST--
Check for issue #30 (DateTimeImmutable::createFromFormat with ! returns DateTime)
--SKIPIF--
<?php
$required_version = "5.5";
$required_func = array("timecop_freeze");
$required_class = array("TimecopDateTimeImmutable");
include(__DIR__."/tests-skipcheck.inc.php");
--INI--
date.timezone=GMT
timecop.func_override=1
--FILE--
<?php
$dt1 = \DateTimeImmutable::createFromFormat('!Y-m-d', '2017-10-03');
$dt2 = \DateTimeImmutable::createFromFormat('!Y-m-d', '2017-10-03');
var_dump(get_class($dt1));
var_dump($dt1->format('c'));
var_dump(get_class($dt2));
var_dump($dt2->format('c'));
--EXPECT--
string(17) "DateTimeImmutable"
string(25) "2017-10-03T00:00:00+00:00"
string(17) "DateTimeImmutable"
string(25) "2017-10-03T00:00:00+00:00"

0 comments on commit 8a12ba7

Please sign in to comment.