Skip to content

Commit c39e777

Browse files
committed
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)
1 parent b5e5098 commit c39e777

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

ext/date/tests/DateTimeZone_getTransitions_basic1.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ date_default_timezone_set("Europe/London");
1616
// Create a DateTimeZone object
1717
$tz = new DateTimeZone("Europe/London");
1818

19-
$tran = $tz->getTransitions();
19+
$tran = $tz->getTransitions(-306972000, -37241999);
2020

2121
if (!is_array($tran)) {
2222
echo "TEST FAILED: Expected an array\n";
@@ -25,14 +25,14 @@ if (!is_array($tran)) {
2525
echo "\n-- Total number of transitions: " . count($tran). " --\n";
2626

2727
echo "\n-- Format a sample entry for Spring 1963 --\n";
28-
var_dump( $tran[97] );
28+
var_dump( $tran[6] );
2929

3030
?>
3131
===DONE===
3232
--EXPECT--
3333
*** Testing DateTimeZone::getTransitions() : basic functionality ***
3434

35-
-- Total number of transitions: 243 --
35+
-- Total number of transitions: 18 --
3636

3737
-- Format a sample entry for Spring 1963 --
3838
array(5) {

ext/date/tests/timezone_transitions_get_basic1.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,24 @@ $tz = timezone_open("Europe/London");
1818

1919
$tran = timezone_transitions_get($tz);
2020

21-
echo "\n-- Get all transitions --\n";
22-
$tran = timezone_transitions_get($tz);
21+
echo "\n-- Get all 60s transitions --\n";
22+
$tran = timezone_transitions_get($tz, -306972000, -37241999);
2323
var_dump( gettype($tran) );
2424

2525
echo "\n-- Total number of transitions: " . count($tran). " --\n";
2626

2727
echo "\n-- Format a sample entry pfor Spring 1963 --\n";
28-
var_dump( $tran[97] );
28+
var_dump( $tran[6] );
2929

3030
?>
3131
===DONE===
3232
--EXPECT--
3333
*** Testing timezone_transitions_get() : basic functionality ***
3434

35-
-- Get all transitions --
35+
-- Get all 60s transitions --
3636
string(5) "array"
3737

38-
-- Total number of transitions: 243 --
38+
-- Total number of transitions: 18 --
3939

4040
-- Format a sample entry pfor Spring 1963 --
4141
array(5) {

0 commit comments

Comments
 (0)