Skip to content

Commit

Permalink
Sync some tests for compat with ICU 58.1, PHP 7.1+ part
Browse files Browse the repository at this point in the history
  • Loading branch information
weltling committed Oct 20, 2017
1 parent 7751ae5 commit 2647352
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 6 deletions.
6 changes: 3 additions & 3 deletions ext/intl/tests/timezone_IDforWindowsID_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ IntlTimeZone::getIDForWindowsID basic test
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
if (version_compare(INTL_ICU_VERSION, '52') < 0)
die('skip for ICU >= 52');
die('skip intl extension not enabled'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '52') < 0)die('skip for ICU >= 52'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '57.1') >= 0) die('skip for ICU <= 57.1'); ?>
--FILE--
<?php

Expand Down
46 changes: 46 additions & 0 deletions ext/intl/tests/timezone_IDforWindowsID_basic2.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
--TEST--
IntlTimeZone::getIDForWindowsID basic test
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '52') < 0) die('skip for ICU >= 52'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '57.1') < 0) die('skip for ICU >= 58.1'); ?>

This comment has been minimized.

Copy link
@staabm

staabm Oct 20, 2017

Contributor

skips for >=52 and >= 58.1 ?

This comment has been minimized.

Copy link
@weltling

weltling Oct 20, 2017

Author Contributor

Thanks, both should be fixed now. Not yet finished, though.

Thanks.

--FILE--
<?php

$tzs = array(
'Gnomeregan' => array(NULL),
'India Standard Time' => array(NULL),
'Pacific Standard Time' => array('001', 'CA', 'MX', 'US', 'ZZ'),
'Romance Standard Time' => array('001', 'BE', 'DK', 'ES', 'FR'),
);

foreach ($tzs as $tz => $regions) {
echo "** $tz\n";
foreach ($regions as $region) {
var_dump(IntlTimeZone::getIDForWindowsID($tz, $region));
if (intl_get_error_code() != U_ZERO_ERROR) {
echo "Error: ", intl_get_error_message(), "\n";
}
}
}

--EXPECT--
** Gnomeregan
bool(false)
Error: intltz_get_windows_id: Unknown windows timezone: U_ILLEGAL_ARGUMENT_ERROR
** India Standard Time
string(13) "Asia/Calcutta"
** Pacific Standard Time
string(19) "America/Los_Angeles"
string(17) "America/Vancouver"
string(19) "America/Los_Angeles"
string(19) "America/Los_Angeles"
string(7) "PST8PDT"
** Romance Standard Time
string(12) "Europe/Paris"
string(15) "Europe/Brussels"
string(17) "Europe/Copenhagen"
string(13) "Europe/Madrid"
string(12) "Europe/Paris"
6 changes: 3 additions & 3 deletions ext/intl/tests/timezone_windowsID_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ IntlTimeZone::getWindowsID basic test
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
if (version_compare(INTL_ICU_VERSION, '52') < 0)
die('skip for ICU >= 52');
die('skip intl extension not enabled'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '52') < 0) die('skip for ICU >= 52'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '57.1') >= 0) die('skip for ICU <= 57.1'); ?>
--FILE--
<?php

Expand Down
43 changes: 43 additions & 0 deletions ext/intl/tests/timezone_windowsID_basic2.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
--TEST--
IntlTimeZone::getWindowsID basic test
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '52') < 0) die('skip for ICU >= 52'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '57.1') < 0) die('skip for ICU >= 58.1'); ?>

This comment has been minimized.

Copy link
@staabm

staabm Oct 20, 2017

Contributor

same here... gues < should be >=

--FILE--
<?php

$tzs = array(
'America/Bogota',
'America/Havana',
'America/Indiana/Knox',
'America/Los_Angeles',
'Azeroth/Kalimdor/Durotar',
'Africa/Casablanca',
'Asia/Singapore',
'Australia/Perth',
'Europe/London',
'Europe/Istanbul',
);

foreach ($tzs as $tz) {
var_dump(IntlTimeZone::getWindowsID($tz));
if (intl_get_error_code() != U_ZERO_ERROR) {
echo "Error: ", intl_get_error_message(), "\n";
}
}

--EXPECT--
string(24) "SA Pacific Standard Time"
string(18) "Cuba Standard Time"
string(21) "Central Standard Time"
string(21) "Pacific Standard Time"
bool(false)
Error: intltz_get_windows_id: Unknown system timezone: U_ILLEGAL_ARGUMENT_ERROR
string(21) "Morocco Standard Time"
string(23) "Singapore Standard Time"
string(26) "W. Australia Standard Time"
string(17) "GMT Standard Time"
string(20) "Turkey Standard Time"

0 comments on commit 2647352

Please sign in to comment.