timezone_createTimeZoneIDEnumeration_variant2.phpt 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. --TEST--
  2. IntlTimeZone::createTimeZoneIDEnumeration(): variant without region
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded('intl'))
  6. die('skip intl extension not enabled');
  7. if (version_compare(INTL_ICU_VERSION, '4.8') < 0)
  8. die('skip for ICU 4.8+');
  9. --FILE--
  10. <?php
  11. ini_set("intl.error_level", E_WARNING);
  12. $enum = IntlTimeZone::createTimeZoneIDEnumeration(
  13. IntlTimeZone::TYPE_ANY);
  14. $countAny = count(iterator_to_array($enum));
  15. $enum = IntlTimeZone::createTimeZoneIDEnumeration(
  16. IntlTimeZone::TYPE_CANONICAL);
  17. $countCanonical = count(iterator_to_array($enum));
  18. $enum = IntlTimeZone::createTimeZoneIDEnumeration(
  19. IntlTimeZone::TYPE_CANONICAL_LOCATION);
  20. $countCanonicalLocation = count(iterator_to_array($enum));
  21. var_dump($countAny > $countCanonical);
  22. var_dump($countCanonical > $countCanonicalLocation);
  23. $enum = IntlTimeZone::createTimeZoneIDEnumeration(
  24. IntlTimeZone::TYPE_ANY, null, null);
  25. $countAny2 = count(iterator_to_array($enum));
  26. var_dump($countAny == $countAny2);
  27. $enum = IntlTimeZone::createTimeZoneIDEnumeration(
  28. IntlTimeZone::TYPE_ANY, null, -3600000);
  29. $values = iterator_to_array($enum);
  30. print_r(
  31. array_values(
  32. array_intersect($values,
  33. array('Etc/GMT+1', 'Atlantic/Azores'))
  34. ));
  35. ?>
  36. ==DONE==
  37. --EXPECT--
  38. bool(true)
  39. bool(true)
  40. bool(true)
  41. Array
  42. (
  43. [0] => Atlantic/Azores
  44. [1] => Etc/GMT+1
  45. )
  46. ==DONE==