gmdate_error.phpt 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. --TEST--
  2. Test gmdate() function : error conditions
  3. --FILE--
  4. <?php
  5. /* Prototype : string gmdate(string format [, long timestamp])
  6. * Description: Format a GMT date/time
  7. * Source code: ext/date/php_date.c
  8. * Alias to functions:
  9. */
  10. echo "*** Testing gmdate() : error conditions ***\n";
  11. // Initialise all required variables
  12. date_default_timezone_set('UTC');
  13. $format = DATE_ISO8601;
  14. $timestamp = mktime(8, 8, 8, 8, 8, 2008);
  15. // Zero arguments
  16. echo "\n-- Testing gmdate() function with Zero arguments --\n";
  17. var_dump( gmdate() );
  18. //Test gmdate with one more than the expected number of arguments
  19. echo "\n-- Testing gmdate() function with more than expected no. of arguments --\n";
  20. $extra_arg = 10;
  21. var_dump( gmdate($format, $timestamp, $extra_arg) );
  22. ?>
  23. ===DONE===
  24. --EXPECTF--
  25. *** Testing gmdate() : error conditions ***
  26. -- Testing gmdate() function with Zero arguments --
  27. Warning: gmdate() expects at least 1 parameter, 0 given in %s on line %d
  28. bool(false)
  29. -- Testing gmdate() function with more than expected no. of arguments --
  30. Warning: gmdate() expects at most 2 parameters, 3 given in %s on line %d
  31. bool(false)
  32. ===DONE===