DateTimeZone_getTransitions_basic1.phpt 1.1 KB

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