com php-src: Make date transitions tests more flexible: ext/date/tests/DateTimeZone_getTransitions_basic1.phpt
ext/date/tests/timezone_transitions_get_basic1.php t
| From: | Remi Collet | Date: | Sat, 18 Apr 2015 05:47:47 +0000 |
| Subject: | com php-src: Make date transitions tests more flexible: ext/date/tests/DateTimeZone_getTransitions_basic1.phpt ext/date/tests/timezone_transitions_get_basic1.php t |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-86363@lists.php.net to get a copy of this message | ||
Commit: cd93b120c3cfb129bca7365f48015c46abeb0333
Author: Remi Collet <remi@php.net> Sat, 18 Apr 2015 07:47:47 +0200
Parents: ffb788800f7c6a4b0a19d422ead22d59a7dadc63
Branches: PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=cd93b120c3cfb129bca7365f48015c46abeb0333
Log:
Make date transitions tests more flexible
zic in recent glibc (2.20) introduce a new transitionn
so use a range to avoid failure when total number
of transitions is different (243/244)
Changed paths:
M ext/date/tests/DateTimeZone_getTransitions_basic1.phpt
M ext/date/tests/timezone_transitions_get_basic1.phpt
Diff:
diff --git a/ext/date/tests/DateTimeZone_getTransitions_basic1.phpt
b/ext/date/tests/DateTimeZone_getTransitions_basic1.phpt
index f3640d1..d178080 100644
--- a/ext/date/tests/DateTimeZone_getTransitions_basic1.phpt
+++ b/ext/date/tests/DateTimeZone_getTransitions_basic1.phpt
@@ -16,7 +16,7 @@ date_default_timezone_set("Europe/London");
// Create a DateTimeZone object
$tz = new DateTimeZone("Europe/London");
-$tran = $tz->getTransitions();
+$tran = $tz->getTransitions(-306972000, -37241999);
if (!is_array($tran)) {
echo "TEST FAILED: Expected an array\n";
@@ -25,14 +25,14 @@ if (!is_array($tran)) {
echo "\n-- Total number of transitions: " . count($tran). " --\n";
echo "\n-- Format a sample entry for Spring 1963 --\n";
-var_dump( $tran[97] );
+var_dump( $tran[6] );
?>
===DONE===
--EXPECT--
*** Testing DateTimeZone::getTransitions() : basic functionality ***
--- Total number of transitions: 243 --
+-- Total number of transitions: 18 --
-- Format a sample entry for Spring 1963 --
array(5) {
diff --git a/ext/date/tests/timezone_transitions_get_basic1.phpt
b/ext/date/tests/timezone_transitions_get_basic1.phpt
index eb6cf99..97c5f0c 100644
--- a/ext/date/tests/timezone_transitions_get_basic1.phpt
+++ b/ext/date/tests/timezone_transitions_get_basic1.phpt
@@ -18,24 +18,24 @@ $tz = timezone_open("Europe/London");
$tran = timezone_transitions_get($tz);
-echo "\n-- Get all transitions --\n";
-$tran = timezone_transitions_get($tz);
+echo "\n-- Get all 60s transitions --\n";
+$tran = timezone_transitions_get($tz, -306972000, -37241999);
var_dump( gettype($tran) );
echo "\n-- Total number of transitions: " . count($tran). " --\n";
echo "\n-- Format a sample entry pfor Spring 1963 --\n";
-var_dump( $tran[97] );
+var_dump( $tran[6] );
?>
===DONE===
--EXPECT--
*** Testing timezone_transitions_get() : basic functionality ***
--- Get all transitions --
+-- Get all 60s transitions --
string(5) "array"
--- Total number of transitions: 243 --
+-- Total number of transitions: 18 --
-- Format a sample entry pfor Spring 1963 --
array(5) {