timezone_transitions_get_basic1.phpt 1.3 KB

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