Annotation of embedaddon/php/ext/date/tests/DateTime_setISODate_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test 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
13: date_default_timezone_set("Europe/London");
14:
15: $datetime = new DateTime("2009-01-30 19:34:10");
16:
17: echo "*** Testing DateTime::setISODate () : error conditions ***\n";
18:
19: echo "\n-- Testing DateTime::setISODate() function with zero arguments --\n";
20: var_dump( $datetime->setISODate() );
21:
22: $year = 2009;
23: echo "\n-- Testing DateTime::setISODate() function with less than expected no. of arguments --\n";
24: var_dump( $datetime->setISODate($year) );
25:
26: echo "\n-- Testing date_isodate_set() function with more than expected no. of arguments --\n";
27: $week = 30;
28: $day = 7;
29: $extra_arg = 30;
30: var_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:
39: Warning: DateTime::setISODate() expects at least 2 parameters, 0 given in %s on line %d
40: bool(false)
41:
42: -- Testing DateTime::setISODate() function with less than expected no. of arguments --
43:
44: Warning: DateTime::setISODate() expects at least 2 parameters, 1 given in %s on line %d
45: bool(false)
46:
47: -- Testing date_isodate_set() function with more than expected no. of arguments --
48:
49: Warning: DateTime::setISODate() expects at most 3 parameters, 4 given in %s on line %d
50: bool(false)
51: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>