DateTimeZone_getTransitions_error.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. --TEST--
  2. Test DateTimeZone::getTransitions() function : error conditions
  3. --FILE--
  4. <?php
  5. /* Prototype : array DateTimeZone::getTransitions ([ 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: timezone_transitions_get()
  9. */
  10. //Set the default time zone
  11. date_default_timezone_set("GMT");
  12. $tz = new DateTimeZone("Europe/London");
  13. echo "*** Testing DateTimeZone::getTransitions() : error conditions ***\n";
  14. echo "\n-- Testing DateTimeZone::getTransitions() function with more than expected no. of arguments --\n";
  15. $timestamp_begin = mktime(0, 0, 0, 1, 1, 1972);
  16. $timestamp_end = mktime(0, 0, 0, 1, 1, 1975);
  17. $extra_arg = 99;
  18. var_dump( $tz->getTransitions($timestamp_begin, $timestamp_end, $extra_arg) );
  19. ?>
  20. ===DONE===
  21. --EXPECTF--
  22. *** Testing DateTimeZone::getTransitions() : error conditions ***
  23. -- Testing DateTimeZone::getTransitions() function with more than expected no. of arguments --
  24. Warning: DateTimeZone::getTransitions() expects at most 2 parameters, 3 given in %s on line %d
  25. bool(false)
  26. ===DONE===