Annotation of embedaddon/php/ext/date/tests/date_date_set_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test date_date_set() function : error conditions
3: --FILE--
4: <?php
5: /* Prototype : DateTime date_date_set ( DateTime $object , int $year , int $month , int $day )
6: * Description: Resets the current date of the DateTime object to a different date.
7: * Source code: ext/date/php_date.c
8: * Alias to functions: DateTime::setDate
9: */
10:
11: date_default_timezone_set("Europe/London");
12:
13: echo "*** Testing date_date_set() : error conditions ***\n";
14:
15: echo "\n-- Testing date_date_set() function with zero arguments --\n";
16: var_dump( date_date_set() );
17:
18: echo "\n-- Testing date_date_set() function with less than expected no. of arguments --\n";
19: $datetime = date_create("2009-01-30 19:34:10");
20: $year = 2009;
21: $month = 1;
22: $day = 30;
23: var_dump( date_date_set($datetime) );
24: var_dump( date_date_set($datetime, $year) );
25: var_dump( date_date_set($datetime, $year, $month) );
26:
27: echo "\n-- Testing date_date_set() function with more than expected no. of arguments --\n";
28: $extra_arg = 10;
29: var_dump( date_date_set($datetime, $year, $month, $day, $extra_arg) );
30:
31: ?>
32: ===DONE===
33: --EXPECTF--
34: *** Testing date_date_set() : error conditions ***
35:
36: -- Testing date_date_set() function with zero arguments --
37:
38: Warning: date_date_set() expects exactly 4 parameters, 0 given in %s on line %d
39: bool(false)
40:
41: -- Testing date_date_set() function with less than expected no. of arguments --
42:
43: Warning: date_date_set() expects exactly 4 parameters, 1 given in %s on line %d
44: bool(false)
45:
46: Warning: date_date_set() expects exactly 4 parameters, 2 given in %s on line %d
47: bool(false)
48:
49: Warning: date_date_set() expects exactly 4 parameters, 3 given in %s on line %d
50: bool(false)
51:
52: -- Testing date_date_set() function with more than expected no. of arguments --
53:
54: Warning: date_date_set() expects exactly 4 parameters, 5 given in %s on line %d
55: bool(false)
56: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>