DateTime_getOffset_error.phpt 913 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. Test DateTime::getOffset() function : error conditions
  3. --FILE--
  4. <?php
  5. /* Prototype : public int DateTime::getOffset ( void )
  6. * Description: Returns the daylight saving time offset
  7. * Source code: ext/date/php_date.c
  8. * Alias to functions: date_offset_get
  9. */
  10. //Set the default time zone
  11. date_default_timezone_set("Europe/London");
  12. echo "*** Testing DateTime::getOffset() : error conditions ***\n";
  13. echo "\n-- Testing DateTime::getOffset() function with more than expected no. of arguments --\n";
  14. $datetime = new DateTime("2009-01-30 19:34:10");
  15. $extra_arg = 30;
  16. var_dump( $datetime->getOffset($extra_arg) );
  17. ?>
  18. ===DONE===
  19. --EXPECTF--
  20. *** Testing DateTime::getOffset() : error conditions ***
  21. -- Testing DateTime::getOffset() function with more than expected no. of arguments --
  22. Warning: DateTime::getOffset() expects exactly 0 parameters, 1 given in %s on line %d
  23. bool(false)
  24. ===DONE===