timezone_IDforWindowsID_basic.phpt 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. --TEST--
  2. IntlTimeZone::getIDForWindowsID 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, '52') < 0)die('skip for ICU >= 52'); ?>
  8. <?php if (version_compare(INTL_ICU_VERSION, '58.1') >= 0) die('skip for ICU <= 57.1'); ?>
  9. --FILE--
  10. <?php
  11. $tzs = array(
  12. 'Gnomeregan' => array(NULL),
  13. 'India Standard Time' => array(NULL),
  14. 'Pacific Standard Time' => array('001', 'CA', 'MX', 'US', 'ZZ'),
  15. 'Romance Standard Time' => array('001', 'BE', 'DK', 'ES', 'FR'),
  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. --EXPECT--
  27. ** Gnomeregan
  28. bool(false)
  29. Error: intltz_get_windows_id: Unknown windows timezone: U_ILLEGAL_ARGUMENT_ERROR
  30. ** India Standard Time
  31. string(13) "Asia/Calcutta"
  32. ** Pacific Standard Time
  33. string(19) "America/Los_Angeles"
  34. string(17) "America/Vancouver"
  35. string(15) "America/Tijuana"
  36. string(19) "America/Los_Angeles"
  37. string(7) "PST8PDT"
  38. ** Romance Standard Time
  39. string(12) "Europe/Paris"
  40. string(15) "Europe/Brussels"
  41. string(17) "Europe/Copenhagen"
  42. string(13) "Europe/Madrid"
  43. string(12) "Europe/Paris"