DateTimeZone_getTransitions_basic1.phpt 937 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --TEST--
  2. Test DateTimeZone::getTransitions() function : basic functionality
  3. --FILE--
  4. <?php
  5. echo "*** Testing DateTimeZone::getTransitions() : basic functionality ***\n";
  6. //Set the default time zone
  7. date_default_timezone_set("Europe/London");
  8. // Create a DateTimeZone object
  9. $tz = new DateTimeZone("Europe/London");
  10. $tran = $tz->getTransitions(-306972000, -37241999);
  11. if (!is_array($tran)) {
  12. echo "TEST FAILED: Expected an array\n";
  13. }
  14. echo "\n-- Total number of transitions: " . count($tran). " --\n";
  15. echo "\n-- Format a sample entry for Spring 1963 --\n";
  16. var_dump( $tran[6] );
  17. ?>
  18. --EXPECT--
  19. *** Testing DateTimeZone::getTransitions() : basic functionality ***
  20. -- Total number of transitions: 18 --
  21. -- Format a sample entry for Spring 1963 --
  22. array(5) {
  23. ["ts"]=>
  24. int(-213228000)
  25. ["time"]=>
  26. string(24) "1963-03-31T02:00:00+0000"
  27. ["offset"]=>
  28. int(3600)
  29. ["isdst"]=>
  30. bool(true)
  31. ["abbr"]=>
  32. string(3) "BST"
  33. }