timezone_windowsID_basic.phpt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --TEST--
  2. IntlTimeZone::getWindowsID basic test
  3. --EXTENSIONS--
  4. intl
  5. --SKIPIF--
  6. <?php if (version_compare(INTL_ICU_VERSION, '52') < 0)die('skip for ICU >= 52'); ?>
  7. <?php if (version_compare(INTL_ICU_VERSION, '58.1') >= 0) die('skip for ICU <= 57.1'); ?>
  8. --FILE--
  9. <?php
  10. $tzs = array(
  11. 'America/Bogota',
  12. 'America/Havana',
  13. 'America/Indiana/Knox',
  14. 'America/Los_Angeles',
  15. 'Azeroth/Kalimdor/Durotar',
  16. 'Africa/Casablanca',
  17. 'Asia/Singapore',
  18. 'Australia/Perth',
  19. 'Europe/London',
  20. 'Europe/Istanbul',
  21. );
  22. foreach ($tzs as $tz) {
  23. var_dump(IntlTimeZone::getWindowsID($tz));
  24. if (intl_get_error_code() != U_ZERO_ERROR) {
  25. echo "Error: ", intl_get_error_message(), "\n";
  26. }
  27. }
  28. ?>
  29. --EXPECT--
  30. string(24) "SA Pacific Standard Time"
  31. string(21) "Eastern Standard Time"
  32. string(21) "Central Standard Time"
  33. string(21) "Pacific Standard Time"
  34. bool(false)
  35. Error: intltz_get_windows_id: Unknown system timezone: U_ILLEGAL_ARGUMENT_ERROR
  36. string(21) "Morocco Standard Time"
  37. string(23) "Singapore Standard Time"
  38. string(26) "W. Australia Standard Time"
  39. string(17) "GMT Standard Time"
  40. string(20) "Turkey Standard Time"