xref: /PHP-5.6/ext/date/tests/checkdate_error.phpt (revision a2e47734)
1--TEST--
2Test 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
11echo "*** Testing checkdate() : error conditions ***\n";
12
13//Set the default time zone
14date_default_timezone_set("America/Chicago");
15
16$arg_0 = 1;
17$arg_1 = 1;
18$arg_2 = 1;
19$extra_arg = 1;
20
21echo "\n-- Testing checkdate() function with more than expected no. of arguments --\n";
22var_dump (checkdate($arg_0, $arg_1, $arg_2, $extra_arg));
23
24echo "\n-- Testing checkdate() function with less than expected no. of arguments --\n";
25var_dump (checkdate());
26var_dump (checkdate($arg_0));
27var_dump (checkdate($arg_0, $arg_1));
28
29?>
30===DONE===
31--EXPECTF--
32*** Testing checkdate() : error conditions ***
33
34-- Testing checkdate() function with more than expected no. of arguments --
35
36Warning: checkdate() expects exactly 3 parameters, 4 given in %s on line %d
37bool(false)
38
39-- Testing checkdate() function with less than expected no. of arguments --
40
41Warning: checkdate() expects exactly 3 parameters, 0 given in %s on line %d
42bool(false)
43
44Warning: checkdate() expects exactly 3 parameters, 1 given in %s on line %d
45bool(false)
46
47Warning: checkdate() expects exactly 3 parameters, 2 given in %s on line %d
48bool(false)
49===DONE===
50