1--TEST--
2Test date_isodate_set() function : error conditions
3--FILE--
4<?php
5
6/* Prototype  : DateTime date_isodate_set  ( DateTime $object  , int $year  , int $week  [, int $day  ] )
7 * Description: Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.
8 * Source code: ext/date/php_date.c
9 * Alias to functions: DateTime::setISODate
10 */
11
12 //Set the default time zone
13date_default_timezone_set("Europe/London");
14
15echo "*** Testing date_isodate_set() : error conditions ***\n";
16
17echo "\n-- Testing date_isodate_set() function with zero arguments --\n";
18var_dump( date_isodate_set() );
19
20$datetime = date_create("2009-01-30 19:34:10");
21echo "\n-- Testing date_isodate_set() function with less than expected no. of arguments --\n";
22var_dump( date_isodate_set($datetime) );
23
24echo "\n-- Testing date_isodate_set() function with more than expected no. of arguments --\n";
25$year = 2009;
26$week = 30;
27$day = 7;
28$extra_arg = 30;
29var_dump( date_isodate_set($datetime, $year, $week, $day, $extra_arg) );
30
31echo "\n-- Testing date_isodate_set() function with an invalid values for \$object argument --\n";
32$invalid_obj = new stdClass();
33var_dump( date_isodate_set($invalid_obj, $year, $week, $day) );
34$invalid_obj = 10;
35var_dump( date_isodate_set($invalid_obj, $year, $week, $day) );
36$invalid_obj = null;
37var_dump( date_isodate_set($invalid_obj, $year, $week, $day) );
38?>
39===DONE===
40--EXPECTF--
41*** Testing date_isodate_set() : error conditions ***
42
43-- Testing date_isodate_set() function with zero arguments --
44
45Warning: date_isodate_set() expects at least 3 parameters, 0 given in %s on line %d
46bool(false)
47
48-- Testing date_isodate_set() function with less than expected no. of arguments --
49
50Warning: date_isodate_set() expects at least 3 parameters, 1 given in %s on line %d
51bool(false)
52
53-- Testing date_isodate_set() function with more than expected no. of arguments --
54
55Warning: date_isodate_set() expects at most 4 parameters, 5 given in %s on line %d
56bool(false)
57
58-- Testing date_isodate_set() function with an invalid values for $object argument --
59
60Warning: date_isodate_set() expects parameter 1 to be DateTime, object given in %s on line %d
61bool(false)
62
63Warning: date_isodate_set() expects parameter 1 to be DateTime, integer given in %s on line %d
64bool(false)
65
66Warning: date_isodate_set() expects parameter 1 to be DateTime, null given in %s on line %d
67bool(false)
68===DONE===
69