timezone_windowsID_basic2.phpt 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. --TEST--
  2. IntlTimeZone::getWindowsID basic test
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded('intl'))
  6. die('skip intl extension not enabled'); ?>
  7. <?php if (version_compare(INTL_ICU_VERSION, '58.1') < 0) die('skip for ICU >= 58.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. --EXPECT--
  29. string(24) "SA Pacific Standard Time"
  30. string(18) "Cuba Standard Time"
  31. string(21) "Central Standard Time"
  32. string(21) "Pacific Standard Time"
  33. bool(false)
  34. Error: intltz_get_windows_id: Unknown system timezone: U_ILLEGAL_ARGUMENT_ERROR
  35. string(21) "Morocco Standard Time"
  36. string(23) "Singapore Standard Time"
  37. string(26) "W. Australia Standard Time"
  38. string(17) "GMT Standard Time"
  39. string(20) "Turkey Standard Time"