diff options
Diffstat (limited to 'ext/date/tests/date_error.phpt')
-rw-r--r-- | ext/date/tests/date_error.phpt | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/ext/date/tests/date_error.phpt b/ext/date/tests/date_error.phpt new file mode 100644 index 0000000..ee9b8f9 --- /dev/null +++ b/ext/date/tests/date_error.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test date() function : error conditions +--FILE-- +<?php +/* Prototype : string date ( string $format [, int $timestamp ] ) + * Description: Format a local time/date. + * Source code: ext/date/php_date.c + */ + +echo "*** Testing date() : error conditions ***\n"; + +//Set the default time zone +date_default_timezone_set("America/Chicago"); + +$format = "m.d.y"; +$timestamp = mktime(10, 44, 30, 2, 27, 2009); + +echo "\n-- Testing date function with no arguments --\n"; +var_dump (date()); + +echo "\n-- Testing date function with more than expected no. of arguments --\n"; +$extra_arg = true; +var_dump (checkdate($format, $timestamp, $extra_arg)); + +?> +===DONE=== +--EXPECTF-- +*** Testing date() : error conditions *** + +-- Testing date function with no arguments -- + +Warning: date() expects at least 1 parameter, 0 given in %s on line %d +bool(false) + +-- Testing date function with more than expected no. of arguments -- + +Warning: checkdate() expects parameter 1 to be long, string given in %s on line %d +bool(false) +===DONE=== |