Annotation of embedaddon/php/ext/date/tests/gmdate_error.phpt, revision 1.1
1.1 ! misho 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:
! 11: echo "*** Testing gmdate() : error conditions ***\n";
! 12:
! 13: // Initialise all required variables
! 14: date_default_timezone_set('UTC');
! 15: $format = DATE_ISO8601;
! 16: $timestamp = mktime(8, 8, 8, 8, 8, 2008);
! 17:
! 18: // Zero arguments
! 19: echo "\n-- Testing gmdate() function with Zero arguments --\n";
! 20: var_dump( gmdate() );
! 21:
! 22: //Test gmdate with one more than the expected number of arguments
! 23: echo "\n-- Testing gmdate() function with more than expected no. of arguments --\n";
! 24: $extra_arg = 10;
! 25: var_dump( gmdate($format, $timestamp, $extra_arg) );
! 26:
! 27: ?>
! 28: ===DONE===
! 29: --EXPECTF--
! 30: *** Testing gmdate() : error conditions ***
! 31:
! 32: -- Testing gmdate() function with Zero arguments --
! 33:
! 34: Warning: gmdate() expects at least 1 parameter, 0 given in %s on line %d
! 35: bool(false)
! 36:
! 37: -- Testing gmdate() function with more than expected no. of arguments --
! 38:
! 39: Warning: gmdate() expects at most 2 parameters, 3 given in %s on line %d
! 40: bool(false)
! 41: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>