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