|
| 1 | +--TEST-- |
| 2 | +IntlTimeZone::getIDForWindowsID basic test |
| 3 | +--EXTENSIONS-- |
| 4 | +intl |
| 5 | +--SKIPIF-- |
| 6 | +<?php if (version_compare(INTL_ICU_VERSION, '76.1') < 0) die('skip for ICU >= 76.1'); ?> |
| 7 | +--FILE-- |
| 8 | +<?php |
| 9 | + |
| 10 | +$tzs = array( |
| 11 | + 'Gnomeregan' => array(NULL), |
| 12 | + 'India Standard Time' => array(NULL), |
| 13 | + 'Pacific Standard Time' => array('001', 'CA', 'MX', 'US', 'ZZ'), |
| 14 | + 'Romance Standard Time' => array('001', 'BE', 'DK', 'ES', 'FR'), |
| 15 | +); |
| 16 | + |
| 17 | +foreach ($tzs as $tz => $regions) { |
| 18 | + echo "** $tz\n"; |
| 19 | + foreach ($regions as $region) { |
| 20 | + var_dump(IntlTimeZone::getIDForWindowsID($tz, $region)); |
| 21 | + if (intl_get_error_code() != U_ZERO_ERROR) { |
| 22 | + echo "Error: ", intl_get_error_message(), "\n"; |
| 23 | + } |
| 24 | + } |
| 25 | +} |
| 26 | +?> |
| 27 | +--EXPECT-- |
| 28 | +** Gnomeregan |
| 29 | +bool(false) |
| 30 | +Error: unknown windows timezone: U_ILLEGAL_ARGUMENT_ERROR |
| 31 | +** India Standard Time |
| 32 | +string(13) "Asia/Calcutta" |
| 33 | +** Pacific Standard Time |
| 34 | +string(19) "America/Los_Angeles" |
| 35 | +string(17) "America/Vancouver" |
| 36 | +string(19) "America/Los_Angeles" |
| 37 | +string(19) "America/Los_Angeles" |
| 38 | +string(19) "America/Los_Angeles" |
| 39 | +** Romance Standard Time |
| 40 | +string(12) "Europe/Paris" |
| 41 | +string(15) "Europe/Brussels" |
| 42 | +string(17) "Europe/Copenhagen" |
| 43 | +string(13) "Europe/Madrid" |
| 44 | +string(12) "Europe/Paris" |
0 commit comments