checkdate_error.phpt 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --TEST--
  2. Test checkdate() function : error conditions
  3. --FILE--
  4. <?php
  5. /* Prototype : bool checkdate ( int $month , int $day , int $year )
  6. * Description: Validate a Gregorian date
  7. * Source code: ext/date/php_date.c
  8. * Alias to functions:
  9. */
  10. echo "*** Testing checkdate() : error conditions ***\n";
  11. //Set the default time zone
  12. date_default_timezone_set("America/Chicago");
  13. $arg_0 = 1;
  14. $arg_1 = 1;
  15. $arg_2 = 1;
  16. $extra_arg = 1;
  17. echo "\n-- Testing checkdate() function with more than expected no. of arguments --\n";
  18. var_dump (checkdate($arg_0, $arg_1, $arg_2, $extra_arg));
  19. echo "\n-- Testing checkdate() function with less than expected no. of arguments --\n";
  20. var_dump (checkdate());
  21. var_dump (checkdate($arg_0));
  22. var_dump (checkdate($arg_0, $arg_1));
  23. ?>
  24. ===DONE===
  25. --EXPECTF--
  26. *** Testing checkdate() : error conditions ***
  27. -- Testing checkdate() function with more than expected no. of arguments --
  28. Warning: checkdate() expects exactly 3 parameters, 4 given in %s on line %d
  29. bool(false)
  30. -- Testing checkdate() function with less than expected no. of arguments --
  31. Warning: checkdate() expects exactly 3 parameters, 0 given in %s on line %d
  32. bool(false)
  33. Warning: checkdate() expects exactly 3 parameters, 1 given in %s on line %d
  34. bool(false)
  35. Warning: checkdate() expects exactly 3 parameters, 2 given in %s on line %d
  36. bool(false)
  37. ===DONE===