DateTimeZone_construct_error.phpt 930 B

1234567891011121314151617181920212223242526272829303132
  1. --TEST--
  2. Test new DateTimeZone() : error conditions
  3. --FILE--
  4. <?php
  5. /* Prototype : DateTimeZone::__construct ( string $timezone )
  6. * Description: Returns new DateTimeZone object
  7. * Source code: ext/date/php_date.c
  8. * Alias to functions:
  9. */
  10. //Set the default time zone
  11. date_default_timezone_set("GMT");
  12. echo "*** Testing DateTimeZone() : error conditions ***\n";
  13. echo "\n-- Testing new DateTimeZone() with more than expected no. of arguments --\n";
  14. $timezone = "GMT";
  15. $extra_arg = 99;
  16. var_dump( new DateTimeZone($timezone, $extra_arg) );
  17. ?>
  18. ===DONE===
  19. --EXPECTF--
  20. *** Testing DateTimeZone() : error conditions ***
  21. -- Testing new DateTimeZone() with more than expected no. of arguments --
  22. Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct() expects exactly 1 parameter, 2 given' in %s:%d
  23. Stack trace:
  24. #0 %s(%d): DateTimeZone->__construct('GMT', 99)
  25. #1 {main}
  26. thrown in %s on line %d