summaryrefslogtreecommitdiff
path: root/ext/date/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ext/date/tests')
-rw-r--r--ext/date/tests/010.phpt19
-rw-r--r--ext/date/tests/DateTimeZone_getLocation.phpt17
-rw-r--r--ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt74
-rw-r--r--ext/date/tests/DateTime_setTime_error.phpt5
-rw-r--r--ext/date/tests/bug45682.phpt4
-rw-r--r--ext/date/tests/bug48678.phpt2
-rw-r--r--ext/date/tests/bug49081.phpt1
-rw-r--r--ext/date/tests/bug49778.phpt6
-rw-r--r--ext/date/tests/bug52113.phpt24
-rw-r--r--ext/date/tests/bug52738.phpt1
-rw-r--r--ext/date/tests/bug52808.phpt12
-rw-r--r--ext/date/tests/bug53437.phpt8
-rw-r--r--ext/date/tests/bug53437_var2.phpt8
-rw-r--r--ext/date/tests/bug53437_var4.phpt6
-rw-r--r--ext/date/tests/bug53437_var5.phpt4
-rw-r--r--ext/date/tests/bug53437_var6.phpt49
-rw-r--r--ext/date/tests/bug60774.phpt2
-rw-r--r--ext/date/tests/date_diff1.phpt6
-rw-r--r--ext/date/tests/date_interval_create_from_date_string_nullparam.phpt6
-rw-r--r--ext/date/tests/date_interval_create_from_date_string_wrongparam_002.phpt3
-rw-r--r--ext/date/tests/date_time_fractions.phpt99
-rw-r--r--ext/date/tests/date_time_fractions_create_from_format.phpt29
-rw-r--r--ext/date/tests/date_time_fractions_serialize.phpt25
-rw-r--r--ext/date/tests/date_time_set_error.phpt5
-rw-r--r--ext/date/tests/timezone_abbreviations_list_basic1.phpt74
-rw-r--r--ext/date/tests/timezone_name_from_abbr_basic1.phpt10
26 files changed, 412 insertions, 87 deletions
diff --git a/ext/date/tests/010.phpt b/ext/date/tests/010.phpt
index 8b39229703..ff42de5dea 100644
--- a/ext/date/tests/010.phpt
+++ b/ext/date/tests/010.phpt
@@ -8,7 +8,7 @@ date_default_timezone_set('UTC');
echo "Done\n";
?>
--EXPECTF--
-array(6) {
+array(5) {
[0]=>
array(3) {
["dst"]=>
@@ -16,18 +16,9 @@ array(6) {
["offset"]=>
int(0)
["timezone_id"]=>
- string(16) "Antarctica/Troll"
- }
- [1]=>
- array(3) {
- ["dst"]=>
- bool(false)
- ["offset"]=>
- int(0)
- ["timezone_id"]=>
string(13) "Etc/Universal"
}
- [2]=>
+ [1]=>
array(3) {
["dst"]=>
bool(false)
@@ -36,7 +27,7 @@ array(6) {
["timezone_id"]=>
string(7) "Etc/UTC"
}
- [3]=>
+ [2]=>
array(3) {
["dst"]=>
bool(false)
@@ -45,7 +36,7 @@ array(6) {
["timezone_id"]=>
string(8) "Etc/Zulu"
}
- [4]=>
+ [3]=>
array(3) {
["dst"]=>
bool(false)
@@ -54,7 +45,7 @@ array(6) {
["timezone_id"]=>
string(3) "UTC"
}
- [5]=>
+ [4]=>
array(3) {
["dst"]=>
bool(false)
diff --git a/ext/date/tests/DateTimeZone_getLocation.phpt b/ext/date/tests/DateTimeZone_getLocation.phpt
index 8e6e33bd17..2dec10ad57 100644
--- a/ext/date/tests/DateTimeZone_getLocation.phpt
+++ b/ext/date/tests/DateTimeZone_getLocation.phpt
@@ -1,6 +1,5 @@
--TEST--
-DateTimeZone::getLocation -- timezone_location_get — Returns location information for a timezone
-public array DateTimeZone::getLocation ( void ) ;
+DateTimeZone::getLocation -- timezone_location_get — Returns location information for a timezone public array DateTimeZone::getLocation ( void ) ;
--CREDITS--
marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br
--SKIPIF--
@@ -66,17 +65,3 @@ Array
[longitude] => %f
[comments] => %s
)
-Array
-(
- [country_code] => %s
- [latitude] => %f
- [longitude] => %f
- [comments] => %s
-)
-Array
-(
- [country_code] => %s
- [latitude] => %f
- [longitude] => %f
- [comments] =>
-)
diff --git a/ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt b/ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt
index e4a5dbd175..1cbaaef377 100644
--- a/ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt
+++ b/ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt
@@ -29,7 +29,7 @@ string(5) "array"
int(%d)
-- Format a sample entry --
-array(11) {
+array(17) {
[0]=>
array(3) {
["dst"]=>
@@ -44,20 +44,29 @@ array(11) {
["dst"]=>
bool(false)
["offset"]=>
- int(34200)
+ int(32400)
["timezone_id"]=>
string(18) "Australia/Adelaide"
}
[2]=>
array(3) {
["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(34200)
+ ["timezone_id"]=>
+ string(18) "Australia/Adelaide"
+ }
+ [3]=>
+ array(3) {
+ ["dst"]=>
bool(true)
["offset"]=>
int(-14400)
["timezone_id"]=>
string(16) "America/Eirunepe"
}
- [3]=>
+ [4]=>
array(3) {
["dst"]=>
bool(true)
@@ -66,7 +75,7 @@ array(11) {
["timezone_id"]=>
string(18) "America/Rio_Branco"
}
- [4]=>
+ [5]=>
array(3) {
["dst"]=>
bool(true)
@@ -75,7 +84,52 @@ array(11) {
["timezone_id"]=>
string(11) "Brazil/Acre"
}
- [5]=>
+ [6]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(32400)
+ ["timezone_id"]=>
+ string(21) "Australia/Broken_Hill"
+ }
+ [7]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(32400)
+ ["timezone_id"]=>
+ string(16) "Australia/Darwin"
+ }
+ [8]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(32400)
+ ["timezone_id"]=>
+ string(15) "Australia/North"
+ }
+ [9]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(32400)
+ ["timezone_id"]=>
+ string(15) "Australia/South"
+ }
+ [10]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(32400)
+ ["timezone_id"]=>
+ string(20) "Australia/Yancowinna"
+ }
+ [11]=>
array(3) {
["dst"]=>
bool(false)
@@ -84,7 +138,7 @@ array(11) {
["timezone_id"]=>
string(13) "Asia/Jayapura"
}
- [6]=>
+ [12]=>
array(3) {
["dst"]=>
bool(false)
@@ -93,7 +147,7 @@ array(11) {
["timezone_id"]=>
string(21) "Australia/Broken_Hill"
}
- [7]=>
+ [13]=>
array(3) {
["dst"]=>
bool(false)
@@ -102,7 +156,7 @@ array(11) {
["timezone_id"]=>
string(16) "Australia/Darwin"
}
- [8]=>
+ [14]=>
array(3) {
["dst"]=>
bool(false)
@@ -111,7 +165,7 @@ array(11) {
["timezone_id"]=>
string(15) "Australia/North"
}
- [9]=>
+ [15]=>
array(3) {
["dst"]=>
bool(false)
@@ -120,7 +174,7 @@ array(11) {
["timezone_id"]=>
string(15) "Australia/South"
}
- [10]=>
+ [16]=>
array(3) {
["dst"]=>
bool(false)
diff --git a/ext/date/tests/DateTime_setTime_error.phpt b/ext/date/tests/DateTime_setTime_error.phpt
index eaf1555d1d..a6b5c5edea 100644
--- a/ext/date/tests/DateTime_setTime_error.phpt
+++ b/ext/date/tests/DateTime_setTime_error.phpt
@@ -25,7 +25,8 @@ echo "\n-- Testing DateTime::setTime() function with more than expected no. of a
$min = 15;
$sec = 30;
$extra_arg = 10;
-var_dump( $datetime->setTime($hour, $min, $sec, $extra_arg) );
+$microseconds = 123123;
+var_dump( $datetime->setTime($hour, $min, $sec, $microseconds, $extra_arg) );
?>
===DONE===
@@ -44,6 +45,6 @@ bool(false)
-- Testing DateTime::setTime() function with more than expected no. of arguments --
-Warning: DateTime::setTime() expects at most 3 parameters, 4 given in %s on line %d
+Warning: DateTime::setTime() expects at most 4 parameters, 5 given in %s on line %d
bool(false)
===DONE===
diff --git a/ext/date/tests/bug45682.phpt b/ext/date/tests/bug45682.phpt
index ea8fa94706..324f64867d 100644
--- a/ext/date/tests/bug45682.phpt
+++ b/ext/date/tests/bug45682.phpt
@@ -12,7 +12,7 @@ $diff = date_diff($date, $other);
var_dump($diff);
--EXPECTF--
-object(DateInterval)#%d (15) {
+object(DateInterval)#%d (16) {
["y"]=>
int(0)
["m"]=>
@@ -25,6 +25,8 @@ object(DateInterval)#%d (15) {
int(0)
["s"]=>
int(0)
+ ["f"]=>
+ float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
diff --git a/ext/date/tests/bug48678.phpt b/ext/date/tests/bug48678.phpt
index 253cb84ce6..9565cb2dfb 100644
--- a/ext/date/tests/bug48678.phpt
+++ b/ext/date/tests/bug48678.phpt
@@ -15,6 +15,7 @@ DateInterval Object
[h] => 12
[i] => 30
[s] => 5
+ [f] => 0
[weekday] => 0
[weekday_behavior] => 0
[first_last_day_of] => 0
@@ -33,6 +34,7 @@ DateInterval Object
[h] => 12
[i] => 30
[s] => 5
+ [f] => 0
[weekday] => 0
[weekday_behavior] => 0
[first_last_day_of] => 0
diff --git a/ext/date/tests/bug49081.phpt b/ext/date/tests/bug49081.phpt
index 31f7351481..b5d17a6c26 100644
--- a/ext/date/tests/bug49081.phpt
+++ b/ext/date/tests/bug49081.phpt
@@ -17,6 +17,7 @@ DateInterval Object
[h] => 4
[i] => 0
[s] => 0
+ [f] => 0
[weekday] => 0
[weekday_behavior] => 0
[first_last_day_of] => 0
diff --git a/ext/date/tests/bug49778.phpt b/ext/date/tests/bug49778.phpt
index 2062d69168..56ce135179 100644
--- a/ext/date/tests/bug49778.phpt
+++ b/ext/date/tests/bug49778.phpt
@@ -7,8 +7,8 @@ var_dump($i);
echo $i->format("%d"), "\n";
echo $i->format("%a"), "\n";
?>
---EXPECT--
-object(DateInterval)#1 (15) {
+--EXPECTF--
+object(DateInterval)#%d (16) {
["y"]=>
int(0)
["m"]=>
@@ -21,6 +21,8 @@ object(DateInterval)#1 (15) {
int(0)
["s"]=>
int(0)
+ ["f"]=>
+ float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
diff --git a/ext/date/tests/bug52113.phpt b/ext/date/tests/bug52113.phpt
index 62c2fca94e..dfc7d6112d 100644
--- a/ext/date/tests/bug52113.phpt
+++ b/ext/date/tests/bug52113.phpt
@@ -23,6 +23,7 @@ $unser = DateInterval::__set_state(array(
'h' => 4,
'i' => 3,
's' => 2,
+ 'f' => 0.876543,
'invert' => 1,
'days' => 2400,
));
@@ -32,7 +33,7 @@ var_dump($unser, $p);
?>
--EXPECT--
-object(DateInterval)#3 (15) {
+object(DateInterval)#3 (16) {
["y"]=>
int(0)
["m"]=>
@@ -45,6 +46,8 @@ object(DateInterval)#3 (15) {
int(0)
["s"]=>
int(0)
+ ["f"]=>
+ float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
@@ -64,7 +67,7 @@ object(DateInterval)#3 (15) {
["have_special_relative"]=>
int(0)
}
-string(320) "O:12:"DateInterval":15:{s:1:"y";i:0;s:1:"m";i:0;s:1:"d";i:0;s:1:"h";i:4;s:1:"i";i:0;s:1:"s";i:0;s:7:"weekday";i:0;s:16:"weekday_behavior";i:0;s:17:"first_last_day_of";i:0;s:6:"invert";i:0;s:4:"days";i:0;s:12:"special_type";i:0;s:14:"special_amount";i:0;s:21:"have_weekday_relative";i:0;s:21:"have_special_relative";i:0;}"
+string(332) "O:12:"DateInterval":16:{s:1:"y";i:0;s:1:"m";i:0;s:1:"d";i:0;s:1:"h";i:4;s:1:"i";i:0;s:1:"s";i:0;s:1:"f";d:0;s:7:"weekday";i:0;s:16:"weekday_behavior";i:0;s:17:"first_last_day_of";i:0;s:6:"invert";i:0;s:4:"days";i:0;s:12:"special_type";i:0;s:14:"special_amount";i:0;s:21:"have_weekday_relative";i:0;s:21:"have_special_relative";i:0;}"
DateInterval::__set_state(array(
'y' => 0,
'm' => 0,
@@ -72,6 +75,7 @@ DateInterval::__set_state(array(
'h' => 4,
'i' => 0,
's' => 0,
+ 'f' => 0.0,
'weekday' => 0,
'weekday_behavior' => 0,
'first_last_day_of' => 0,
@@ -81,7 +85,7 @@ DateInterval::__set_state(array(
'special_amount' => 0,
'have_weekday_relative' => 0,
'have_special_relative' => 0,
-))object(DateInterval)#5 (15) {
+))object(DateInterval)#5 (16) {
["y"]=>
int(0)
["m"]=>
@@ -94,6 +98,8 @@ DateInterval::__set_state(array(
int(0)
["s"]=>
int(0)
+ ["f"]=>
+ float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
@@ -128,7 +134,7 @@ object(DatePeriod)#6 (6) {
["end"]=>
NULL
["interval"]=>
- object(DateInterval)#7 (15) {
+ object(DateInterval)#7 (16) {
["y"]=>
int(0)
["m"]=>
@@ -141,6 +147,8 @@ object(DatePeriod)#6 (6) {
int(0)
["s"]=>
int(0)
+ ["f"]=>
+ float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
@@ -165,7 +173,7 @@ object(DatePeriod)#6 (6) {
["include_start_date"]=>
bool(true)
}
-object(DateInterval)#8 (15) {
+object(DateInterval)#8 (16) {
["y"]=>
int(7)
["m"]=>
@@ -178,6 +186,8 @@ object(DateInterval)#8 (15) {
int(3)
["s"]=>
int(2)
+ ["f"]=>
+ float(0.876543)
["weekday"]=>
int(-1)
["weekday_behavior"]=>
@@ -212,7 +222,7 @@ object(DatePeriod)#9 (6) {
["end"]=>
NULL
["interval"]=>
- object(DateInterval)#7 (15) {
+ object(DateInterval)#7 (16) {
["y"]=>
int(0)
["m"]=>
@@ -225,6 +235,8 @@ object(DatePeriod)#9 (6) {
int(0)
["s"]=>
int(0)
+ ["f"]=>
+ float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
diff --git a/ext/date/tests/bug52738.phpt b/ext/date/tests/bug52738.phpt
index ea219f7c7c..6ed72af1c1 100644
--- a/ext/date/tests/bug52738.phpt
+++ b/ext/date/tests/bug52738.phpt
@@ -27,6 +27,7 @@ di Object
[h] => 0
[i] => 0
[s] => 0
+ [f] => 0
[weekday] => 0
[weekday_behavior] => 0
[first_last_day_of] => 0
diff --git a/ext/date/tests/bug52808.phpt b/ext/date/tests/bug52808.phpt
index 1f0fc84cd7..810874858f 100644
--- a/ext/date/tests/bug52808.phpt
+++ b/ext/date/tests/bug52808.phpt
@@ -25,7 +25,7 @@ foreach($intervals as $iv) {
echo "==DONE==\n";
?>
--EXPECTF--
-object(DateInterval)#%d (15) {
+object(DateInterval)#%d (16) {
["y"]=>
int(1)
["m"]=>
@@ -38,6 +38,8 @@ object(DateInterval)#%d (15) {
int(30)
["s"]=>
int(0)
+ ["f"]=>
+ float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
@@ -57,7 +59,7 @@ object(DateInterval)#%d (15) {
["have_special_relative"]=>
int(0)
}
-object(DateInterval)#%d (15) {
+object(DateInterval)#%d (16) {
["y"]=>
int(0)
["m"]=>
@@ -70,6 +72,8 @@ object(DateInterval)#%d (15) {
int(30)
["s"]=>
int(0)
+ ["f"]=>
+ float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
@@ -89,7 +93,7 @@ object(DateInterval)#%d (15) {
["have_special_relative"]=>
int(0)
}
-object(DateInterval)#%d (15) {
+object(DateInterval)#%d (16) {
["y"]=>
int(0)
["m"]=>
@@ -102,6 +106,8 @@ object(DateInterval)#%d (15) {
int(30)
["s"]=>
int(0)
+ ["f"]=>
+ float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
diff --git a/ext/date/tests/bug53437.phpt b/ext/date/tests/bug53437.phpt
index f82a4879b3..0be9691a14 100644
--- a/ext/date/tests/bug53437.phpt
+++ b/ext/date/tests/bug53437.phpt
@@ -51,7 +51,7 @@ object(DatePeriod)#1 (6) {
["end"]=>
NULL
["interval"]=>
- object(DateInterval)#5 (15) {
+ object(DateInterval)#5 (16) {
["y"]=>
int(0)
["m"]=>
@@ -64,6 +64,8 @@ object(DatePeriod)#1 (6) {
int(0)
["s"]=>
int(0)
+ ["f"]=>
+ float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
@@ -110,7 +112,7 @@ object(DatePeriod)#5 (6) {
["end"]=>
NULL
["interval"]=>
- object(DateInterval)#8 (15) {
+ object(DateInterval)#8 (16) {
["y"]=>
int(0)
["m"]=>
@@ -123,6 +125,8 @@ object(DatePeriod)#5 (6) {
int(0)
["s"]=>
int(0)
+ ["f"]=>
+ float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
diff --git a/ext/date/tests/bug53437_var2.phpt b/ext/date/tests/bug53437_var2.phpt
index 50aebda57c..2ef21e738e 100644
--- a/ext/date/tests/bug53437_var2.phpt
+++ b/ext/date/tests/bug53437_var2.phpt
@@ -13,7 +13,7 @@ var_dump($di0, $di1);
?>
==DONE==
--EXPECT--
-object(DateInterval)#1 (15) {
+object(DateInterval)#1 (16) {
["y"]=>
int(2)
["m"]=>
@@ -26,6 +26,8 @@ object(DateInterval)#1 (15) {
int(8)
["s"]=>
int(0)
+ ["f"]=>
+ float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
@@ -45,7 +47,7 @@ object(DateInterval)#1 (15) {
["have_special_relative"]=>
int(0)
}
-object(DateInterval)#2 (15) {
+object(DateInterval)#2 (16) {
["y"]=>
int(2)
["m"]=>
@@ -58,6 +60,8 @@ object(DateInterval)#2 (15) {
int(8)
["s"]=>
int(0)
+ ["f"]=>
+ float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
diff --git a/ext/date/tests/bug53437_var4.phpt b/ext/date/tests/bug53437_var4.phpt
index 88fd81c9db..189c15cb1b 100644
--- a/ext/date/tests/bug53437_var4.phpt
+++ b/ext/date/tests/bug53437_var4.phpt
@@ -15,13 +15,14 @@ var_dump($df,
$df->h,
$df->i,
$df->s,
+ $df->f,
$df->invert,
$df->days);
?>
==DONE==
--EXPECTF--
-object(DateInterval)#%d (15) {
+object(DateInterval)#%d (16) {
["y"]=>
int(0)
["m"]=>
@@ -34,6 +35,8 @@ object(DateInterval)#%d (15) {
int(0)
["s"]=>
int(0)
+ ["f"]=>
+ float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
@@ -59,6 +62,7 @@ int(2)
int(0)
int(0)
int(0)
+float(0)
int(0)
int(2)
==DONE==
diff --git a/ext/date/tests/bug53437_var5.phpt b/ext/date/tests/bug53437_var5.phpt
index e95fcdae96..38783b1545 100644
--- a/ext/date/tests/bug53437_var5.phpt
+++ b/ext/date/tests/bug53437_var5.phpt
@@ -12,7 +12,7 @@ var_dump($di);
?>
==DONE==
--EXPECTF--
-object(DateInterval)#%d (15) {
+object(DateInterval)#%d (16) {
["y"]=>
int(2)
["m"]=>
@@ -43,5 +43,7 @@ object(DateInterval)#%d (15) {
int(9)
["have_special_relative"]=>
int(0)
+ ["f"]=>
+ float(-1)
}
==DONE==
diff --git a/ext/date/tests/bug53437_var6.phpt b/ext/date/tests/bug53437_var6.phpt
new file mode 100644
index 0000000000..633fcb3f38
--- /dev/null
+++ b/ext/date/tests/bug53437_var6.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Bug #53437 DateInterval unserialize bad data, 64 bit
+--SKIPIF--
+<?php if (PHP_INT_SIZE != 8) { die('skip true 64 bit only'); } ?>
+--FILE--
+<?php
+$s = 'O:12:"DateInterval":16:{s:1:"y";s:1:"2";s:1:"m";s:1:"0";s:1:"d";s:3:"bla";s:1:"h";s:1:"6";s:1:"i";s:1:"8";s:1:"s";s:1:"0";s:1:"f";d:0.123654;s:7:"weekday";i:10;s:16:"weekday_behavior";i:10;s:17:"first_last_day_of";i:0;s:6:"invert";i:0;s:4:"days";s:4:"aoeu";s:12:"special_type";i:0;s:14:"special_amount";s:21:"234523452345234532455";s:21:"have_weekday_relative";i:21474836489;s:21:"have_special_relative";s:3:"bla";}';
+
+$di = unserialize($s);
+var_dump($di);
+
+?>
+==DONE==
+--EXPECTF--
+object(DateInterval)#%d (16) {
+ ["y"]=>
+ int(2)
+ ["m"]=>
+ int(0)
+ ["d"]=>
+ int(0)
+ ["h"]=>
+ int(6)
+ ["i"]=>
+ int(8)
+ ["s"]=>
+ int(0)
+ ["f"]=>
+ float(0.123654)
+ ["weekday"]=>
+ int(10)
+ ["weekday_behavior"]=>
+ int(10)
+ ["first_last_day_of"]=>
+ int(0)
+ ["invert"]=>
+ int(0)
+ ["days"]=>
+ int(0)
+ ["special_type"]=>
+ int(0)
+ ["special_amount"]=>
+ int(9223372036854775807)
+ ["have_weekday_relative"]=>
+ int(9)
+ ["have_special_relative"]=>
+ int(0)
+}
+==DONE==
diff --git a/ext/date/tests/bug60774.phpt b/ext/date/tests/bug60774.phpt
index 7045cd7781..0a9c4223c3 100644
--- a/ext/date/tests/bug60774.phpt
+++ b/ext/date/tests/bug60774.phpt
@@ -21,6 +21,8 @@ object(DateInterval)#1 (%d) {
int(0)
["s"]=>
int(0)
+ ["f"]=>
+ float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
diff --git a/ext/date/tests/date_diff1.phpt b/ext/date/tests/date_diff1.phpt
index fefffcde52..2b73eae6a8 100644
--- a/ext/date/tests/date_diff1.phpt
+++ b/ext/date/tests/date_diff1.phpt
@@ -11,7 +11,7 @@ var_dump($start);
var_dump($end);
var_dump($int);
?>
---EXPECT--
+--EXPECTF--
object(DateTime)#1 (3) {
["date"]=>
string(26) "2010-10-04 02:18:48.000000"
@@ -28,7 +28,7 @@ object(DateTime)#2 (3) {
["timezone"]=>
string(3) "EDT"
}
-object(DateInterval)#3 (15) {
+object(DateInterval)#%d (16) {
["y"]=>
int(0)
["m"]=>
@@ -41,6 +41,8 @@ object(DateInterval)#3 (15) {
int(19)
["s"]=>
int(40)
+ ["f"]=>
+ float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
diff --git a/ext/date/tests/date_interval_create_from_date_string_nullparam.phpt b/ext/date/tests/date_interval_create_from_date_string_nullparam.phpt
index 369db5714a..526b474e47 100644
--- a/ext/date/tests/date_interval_create_from_date_string_nullparam.phpt
+++ b/ext/date/tests/date_interval_create_from_date_string_nullparam.phpt
@@ -8,7 +8,7 @@ $i = date_interval_create_from_date_string(null); //returns a empty object
var_dump($i);
?>
--EXPECTF--
-object(DateInterval)#1 (15) {
+object(DateInterval)#%d (16) {
["y"]=>
int(0)
["m"]=>
@@ -21,6 +21,8 @@ object(DateInterval)#1 (15) {
int(0)
["s"]=>
int(0)
+ ["f"]=>
+ float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
@@ -39,4 +41,4 @@ object(DateInterval)#1 (15) {
int(0)
["have_special_relative"]=>
int(0)
-} \ No newline at end of file
+}
diff --git a/ext/date/tests/date_interval_create_from_date_string_wrongparam_002.phpt b/ext/date/tests/date_interval_create_from_date_string_wrongparam_002.phpt
index a3407c3967..89cea6abf3 100644
--- a/ext/date/tests/date_interval_create_from_date_string_wrongparam_002.phpt
+++ b/ext/date/tests/date_interval_create_from_date_string_wrongparam_002.phpt
@@ -1,9 +1,8 @@
--TEST--
Test date_interval_create_from_date_string() function : with 2 parameters (wrong).
-Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
--FILE--
<?php
$i = date_interval_create_from_date_string('1 year', 'wrong');
?>
--EXPECTF--
-Warning: date_interval_create_from_date_string() expects exactly 1 parameter, 2 given in %s on line %d \ No newline at end of file
+Warning: date_interval_create_from_date_string() expects exactly 1 parameter, 2 given in %s on line %d
diff --git a/ext/date/tests/date_time_fractions.phpt b/ext/date/tests/date_time_fractions.phpt
new file mode 100644
index 0000000000..c58ed4f431
--- /dev/null
+++ b/ext/date/tests/date_time_fractions.phpt
@@ -0,0 +1,99 @@
+--TEST--
+Fractions with DateTime objects
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+/* This will go wrong, once in a million times */
+$ms = date_create()->format('u');
+echo ($ms = 0) ? "microseconds = false\n" : "microseconds = true\n";
+
+/* Normal creation */
+echo date_create( "2016-10-03 12:47:18.819313" )->format( "Y-m-d H:i:s.u" ), "\n\n";
+
+/* With modifications */
+$dt = new DateTimeImmutable( "2016-10-03 12:47:18.819210" );
+echo $dt->modify( "+1 day" )->format( "Y-m-d H:i:s.u" ), "\n";
+
+$dt = new DateTimeImmutable( "2016-10-03 12:47:18.081921" );
+echo $dt->modify( "-3 months" )->format( "Y-m-d H:i:s.u" ), "\n";
+
+echo "\n";
+
+/* These should reset the time (and hence fraction) to 0 */
+$dt = new DateTimeImmutable( "2016-10-03 12:47:18.081921" );
+echo $dt->modify( "yesterday" )->format( "Y-m-d H:i:s.u" ), "\n";
+
+$dt = new DateTimeImmutable( "2016-10-03 12:47:18.081921" );
+echo $dt->modify( "noon" )->format( "Y-m-d H:i:s.u" ), "\n";
+
+$dt = new DateTimeImmutable( "2016-10-03 12:47:18.081921" );
+echo $dt->modify( "10 weekday" )->format( "Y-m-d H:i:s.u" ), "\n";
+
+/* Interval containing fractions */
+
+$dt1 = new DateTimeImmutable( "2016-10-03 13:20:07.103123" );
+$dt2 = new DateTimeImmutable( "2016-10-03 13:20:07.481312" );
+$diff = $dt1->diff( $dt2 );
+
+var_dump( $diff );
+
+$dt0 = $dt1->sub( $diff );
+$dt3 = $dt2->add( $diff );
+$dt4 = $dt3->add( $diff );
+
+echo $dt0->format( "Y-m-d H:i:s.u" ), "\n";
+echo $dt1->format( "Y-m-d H:i:s.u" ), "\n";
+echo $dt2->format( "Y-m-d H:i:s.u" ), "\n";
+echo $dt3->format( "Y-m-d H:i:s.u" ), "\n";
+echo $dt4->format( "Y-m-d H:i:s.u" ), "\n";
+?>
+--EXPECTF--
+microseconds = true
+2016-10-03 12:47:18.819313
+
+2016-10-04 12:47:18.819210
+2016-07-03 12:47:18.081921
+
+2016-10-02 00:00:00.000000
+2016-10-03 12:00:00.000000
+2016-10-17 00:00:00.000000
+object(DateInterval)#%d (16) {
+ ["y"]=>
+ int(0)
+ ["m"]=>
+ int(0)
+ ["d"]=>
+ int(0)
+ ["h"]=>
+ int(0)
+ ["i"]=>
+ int(0)
+ ["s"]=>
+ int(0)
+ ["f"]=>
+ float(0.378189)
+ ["weekday"]=>
+ int(0)
+ ["weekday_behavior"]=>
+ int(0)
+ ["first_last_day_of"]=>
+ int(0)
+ ["invert"]=>
+ int(0)
+ ["days"]=>
+ int(0)
+ ["special_type"]=>
+ int(0)
+ ["special_amount"]=>
+ int(0)
+ ["have_weekday_relative"]=>
+ int(0)
+ ["have_special_relative"]=>
+ int(0)
+}
+2016-10-03 13:20:06.724934
+2016-10-03 13:20:07.103123
+2016-10-03 13:20:07.481312
+2016-10-03 13:20:07.859501
+2016-10-03 13:20:08.237690
diff --git a/ext/date/tests/date_time_fractions_create_from_format.phpt b/ext/date/tests/date_time_fractions_create_from_format.phpt
new file mode 100644
index 0000000000..c598f174ad
--- /dev/null
+++ b/ext/date/tests/date_time_fractions_create_from_format.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Fractions with DateTime objects (create_from_format)
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+$dt = date_create_from_format( "Y-m-d H:i:s.u", "2016-10-03 12:47:18.819313" );
+var_dump( $dt );
+
+$dt = date_create_from_format( "U.u", "1475500799.176312" );
+var_dump( $dt );
+?>
+--EXPECTF--
+object(DateTime)#%d (%d) {
+ ["date"]=>
+ string(26) "2016-10-03 12:47:18.819313"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(3) "UTC"
+}
+object(DateTime)#%d (%d) {
+ ["date"]=>
+ string(26) "2016-10-03 13:19:59.176312"
+ ["timezone_type"]=>
+ int(1)
+ ["timezone"]=>
+ string(6) "+00:00"
+}
diff --git a/ext/date/tests/date_time_fractions_serialize.phpt b/ext/date/tests/date_time_fractions_serialize.phpt
new file mode 100644
index 0000000000..4931bb02b3
--- /dev/null
+++ b/ext/date/tests/date_time_fractions_serialize.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Fractions with DateTime objects (Serialization)
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+/* Normal creation */
+$dt = date_create( "2016-10-03 12:47:18.819313" );
+
+$s = serialize( $dt );
+echo $s, "\n";
+
+$u = unserialize( $s );
+var_dump( $u );
+?>
+--EXPECTF--
+O:8:"DateTime":3:{s:4:"date";s:26:"2016-10-03 12:47:18.819313";s:13:"timezone_type";i:3;s:8:"timezone";s:3:"UTC";}
+object(DateTime)#2 (%d) {
+ ["date"]=>
+ string(26) "2016-10-03 12:47:18.819313"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(3) "UTC"
+}
diff --git a/ext/date/tests/date_time_set_error.phpt b/ext/date/tests/date_time_set_error.phpt
index 8e5c855bcd..5c5ddaf4d2 100644
--- a/ext/date/tests/date_time_set_error.phpt
+++ b/ext/date/tests/date_time_set_error.phpt
@@ -24,8 +24,9 @@ var_dump( date_time_set($datetime, $hour) );
echo "\n-- Testing date_time_set() function with more than expected no. of arguments --\n";
$min = 15;
$sec = 30;
+$microseconds = 123123;
$extra_arg = 10;
-var_dump( date_time_set($datetime, $hour, $min, $sec, $extra_arg) );
+var_dump( date_time_set($datetime, $hour, $min, $sec, $microseconds, $extra_arg) );
echo "\n-- Testing date_time_set() function with an invalid values for \$object argument --\n";
$invalid_obj = new stdClass();
@@ -54,7 +55,7 @@ bool(false)
-- Testing date_time_set() function with more than expected no. of arguments --
-Warning: date_time_set() expects at most 4 parameters, 5 given in %s on line %d
+Warning: date_time_set() expects at most 5 parameters, 6 given in %s on line %d
bool(false)
-- Testing date_time_set() function with an invalid values for $object argument --
diff --git a/ext/date/tests/timezone_abbreviations_list_basic1.phpt b/ext/date/tests/timezone_abbreviations_list_basic1.phpt
index 73af2acf3d..7a0dcdee98 100644
--- a/ext/date/tests/timezone_abbreviations_list_basic1.phpt
+++ b/ext/date/tests/timezone_abbreviations_list_basic1.phpt
@@ -29,7 +29,7 @@ string(5) "array"
int(%d)
-- Format a sample entry --
-array(11) {
+array(17) {
[0]=>
array(3) {
["dst"]=>
@@ -44,20 +44,29 @@ array(11) {
["dst"]=>
bool(false)
["offset"]=>
- int(34200)
+ int(32400)
["timezone_id"]=>
string(18) "Australia/Adelaide"
}
[2]=>
array(3) {
["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(34200)
+ ["timezone_id"]=>
+ string(18) "Australia/Adelaide"
+ }
+ [3]=>
+ array(3) {
+ ["dst"]=>
bool(true)
["offset"]=>
int(-14400)
["timezone_id"]=>
string(16) "America/Eirunepe"
}
- [3]=>
+ [4]=>
array(3) {
["dst"]=>
bool(true)
@@ -66,7 +75,7 @@ array(11) {
["timezone_id"]=>
string(18) "America/Rio_Branco"
}
- [4]=>
+ [5]=>
array(3) {
["dst"]=>
bool(true)
@@ -75,7 +84,52 @@ array(11) {
["timezone_id"]=>
string(11) "Brazil/Acre"
}
- [5]=>
+ [6]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(32400)
+ ["timezone_id"]=>
+ string(21) "Australia/Broken_Hill"
+ }
+ [7]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(32400)
+ ["timezone_id"]=>
+ string(16) "Australia/Darwin"
+ }
+ [8]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(32400)
+ ["timezone_id"]=>
+ string(15) "Australia/North"
+ }
+ [9]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(32400)
+ ["timezone_id"]=>
+ string(15) "Australia/South"
+ }
+ [10]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(32400)
+ ["timezone_id"]=>
+ string(20) "Australia/Yancowinna"
+ }
+ [11]=>
array(3) {
["dst"]=>
bool(false)
@@ -84,7 +138,7 @@ array(11) {
["timezone_id"]=>
string(13) "Asia/Jayapura"
}
- [6]=>
+ [12]=>
array(3) {
["dst"]=>
bool(false)
@@ -93,7 +147,7 @@ array(11) {
["timezone_id"]=>
string(21) "Australia/Broken_Hill"
}
- [7]=>
+ [13]=>
array(3) {
["dst"]=>
bool(false)
@@ -102,7 +156,7 @@ array(11) {
["timezone_id"]=>
string(16) "Australia/Darwin"
}
- [8]=>
+ [14]=>
array(3) {
["dst"]=>
bool(false)
@@ -111,7 +165,7 @@ array(11) {
["timezone_id"]=>
string(15) "Australia/North"
}
- [9]=>
+ [15]=>
array(3) {
["dst"]=>
bool(false)
@@ -120,7 +174,7 @@ array(11) {
["timezone_id"]=>
string(15) "Australia/South"
}
- [10]=>
+ [16]=>
array(3) {
["dst"]=>
bool(false)
diff --git a/ext/date/tests/timezone_name_from_abbr_basic1.phpt b/ext/date/tests/timezone_name_from_abbr_basic1.phpt
index b591fe28f9..492c623eb1 100644
--- a/ext/date/tests/timezone_name_from_abbr_basic1.phpt
+++ b/ext/date/tests/timezone_name_from_abbr_basic1.phpt
@@ -24,11 +24,7 @@ var_dump( timezone_name_from_abbr("EDT") );
echo "-- Lookup with name and offset--\n";
var_dump( timezone_name_from_abbr("ADT", -10800) );
var_dump( timezone_name_from_abbr("ADT", 14400) );
-var_dump( timezone_name_from_abbr("AKTT", 14400) );
-var_dump( timezone_name_from_abbr("aktt", 18000) );
-var_dump( timezone_name_from_abbr("Aktt", 21600) );
var_dump( timezone_name_from_abbr("AMST", -10800) );
-var_dump( timezone_name_from_abbr("amst", 180000) );
echo "-- Tests without valid name - uses gmtOffset and isdst to find match --\n";
var_dump( timezone_name_from_abbr("", 3600, 1) );
@@ -52,11 +48,7 @@ string(16) "America/New_York"
-- Lookup with name and offset--
string(15) "America/Halifax"
string(12) "Asia/Baghdad"
-string(11) "Asia/Aqtobe"
-string(11) "Asia/Aqtobe"
-string(11) "Asia/Aqtobe"
string(17) "America/Boa_Vista"
-string(12) "Asia/Yerevan"
-- Tests without valid name - uses gmtOffset and isdst to find match --
string(13) "Europe/London"
string(17) "America/Sao_Paulo"
@@ -65,4 +57,4 @@ string(15) "America/Halifax"
-- Tests with invalid offsets --
bool(false)
bool(false)
-===DONE=== \ No newline at end of file
+===DONE===