1--TEST--
2Test DateTime::setDate() function : error conditions
3--FILE--
4<?php
5/* Prototype  : public DateTime DateTime::setDate  ( 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: date_date_set()
9 */
10
11date_default_timezone_set("Europe/London");
12
13echo "*** Testing DateTime::setDate() : error conditions ***\n";
14
15$datetime = new DateTime("2009-01-30 19:34:10");
16
17echo "\n-- Testing DateTime::setDate() function with zero arguments --\n";
18var_dump( $datetime->setDate() );
19
20echo "\n-- Testing DateTime::setDate() function with less than expected no. of arguments --\n";
21$year = 2009;
22$month = 1;
23$day = 30;
24var_dump( $datetime->setDate($year) );
25var_dump( $datetime->setDate($year, $month) );
26
27echo "\n-- Testing DateTime::setDate() function with more than expected no. of arguments --\n";
28$extra_arg = 10;
29var_dump( $datetime->setDate($year, $month, $day, $extra_arg) );
30
31?>
32===DONE===
33--EXPECTF--
34*** Testing DateTime::setDate() : error conditions ***
35
36-- Testing DateTime::setDate() function with zero arguments --
37
38Warning: DateTime::setDate() expects exactly 3 parameters, 0 given in %s on line %d
39bool(false)
40
41-- Testing DateTime::setDate() function with less than expected no. of arguments --
42
43Warning: DateTime::setDate() expects exactly 3 parameters, 1 given in %s on line %d
44bool(false)
45
46Warning: DateTime::setDate() expects exactly 3 parameters, 2 given in %s on line %d
47bool(false)
48
49-- Testing DateTime::setDate() function with more than expected no. of arguments --
50
51Warning: DateTime::setDate() expects exactly 3 parameters, 4 given in %s on line %d
52bool(false)
53===DONE===
54