idate_error.phpt 987 B

12345678910111213141516171819202122232425262728293031323334353637
  1. --TEST--
  2. Test idate() function : error conditions
  3. --FILE--
  4. <?php
  5. /* Prototype : int idate(string format [, int timestamp])
  6. * Description: Format a local time/date as integer
  7. * Source code: ext/date/php_date.c
  8. * Alias to functions:
  9. */
  10. echo "*** Testing idate() : error conditions ***\n";
  11. echo "\n-- Testing idate() function with Zero arguments --\n";
  12. var_dump( idate() );
  13. echo "\n-- Testing idate() function with more than expected no. of arguments --\n";
  14. $format = '%b %d %Y %H:%M:%S';
  15. $timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
  16. $extra_arg = 10;
  17. var_dump( idate($format, $timestamp, $extra_arg) );
  18. ?>
  19. ===DONE===
  20. --EXPECTF--
  21. *** Testing idate() : error conditions ***
  22. -- Testing idate() function with Zero arguments --
  23. Warning: idate() expects at least 1 parameter, 0 given in %s on line %d
  24. bool(false)
  25. -- Testing idate() function with more than expected no. of arguments --
  26. Warning: idate() expects at most 2 parameters, 3 given in %s on line %d
  27. bool(false)
  28. ===DONE===