1--TEST--
2Test 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
11date_default_timezone_set("Europe/London");
12
13echo "*** Testing date_date_set() : error conditions ***\n";
14
15echo "\n-- Testing date_date_set() function with zero arguments --\n";
16var_dump( date_date_set() );
17
18echo "\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;
23var_dump( date_date_set($datetime) );
24var_dump( date_date_set($datetime, $year) );
25var_dump( date_date_set($datetime, $year, $month) );
26
27echo "\n-- Testing date_date_set() function with more than expected no. of arguments --\n";
28$extra_arg = 10;
29var_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
38Warning: date_date_set() expects exactly 4 parameters, 0 given in %s on line %d
39bool(false)
40
41-- Testing date_date_set() function with less than expected no. of arguments --
42
43Warning: date_date_set() expects exactly 4 parameters, 1 given in %s on line %d
44bool(false)
45
46Warning: date_date_set() expects exactly 4 parameters, 2 given in %s on line %d
47bool(false)
48
49Warning: date_date_set() expects exactly 4 parameters, 3 given in %s on line %d
50bool(false)
51
52-- Testing date_date_set() function with more than expected no. of arguments --
53
54Warning: date_date_set() expects exactly 4 parameters, 5 given in %s on line %d
55bool(false)
56===DONE===
57