-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement timecop_date_create() / Do refactoring
- Loading branch information
Showing
3 changed files
with
276 additions
and
363 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--TEST-- | ||
Function overrideing test for date_create | ||
--SKIPIF-- | ||
<?php | ||
extension_loaded('timecop') or die('skip timecop not available'); | ||
$required_func = array("timecop_freeze", "timecop_orig_strtotime", "date_create"); | ||
foreach ($required_func as $func_name) { | ||
if (!function_exists($func_name)) { | ||
die("skip $func_name() function is not available."); | ||
} | ||
} | ||
$required_class = array("datetime"); | ||
foreach ($required_class as $class_name) { | ||
if (!class_exists($class_name)) { | ||
die("skip $class_name class is not available."); | ||
} | ||
} | ||
--INI-- | ||
date.timezone=America/Los_Angeles | ||
--FILE-- | ||
<?php | ||
timecop_freeze(timecop_orig_strtotime("2012-02-29 01:23:45")); | ||
|
||
// constuctor with 0 argument | ||
$dt = date_create(); | ||
var_dump($dt->format("c")); | ||
|
||
// constuctor with 1 argument | ||
$dt2 = date_create("+3days"); | ||
var_dump($dt2->format("c")); | ||
--EXPECT-- | ||
string(25) "2012-02-29T01:23:45-08:00" | ||
string(25) "2012-03-03T01:23:45-08:00" |
Oops, something went wrong.