gmstrftime_error.phpt 1.1 KB

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