Annotation of embedaddon/php/ext/date/tests/date_isodate_set_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test 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
13: date_default_timezone_set("Europe/London");
14:
15: echo "*** Testing date_isodate_set() : error conditions ***\n";
16:
17: echo "\n-- Testing date_isodate_set() function with zero arguments --\n";
18: var_dump( date_isodate_set() );
19:
20: $datetime = date_create("2009-01-30 19:34:10");
21: echo "\n-- Testing date_isodate_set() function with less than expected no. of arguments --\n";
22: var_dump( date_isodate_set($datetime) );
23:
24: echo "\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;
29: var_dump( date_isodate_set($datetime, $year, $week, $day, $extra_arg) );
30:
31: echo "\n-- Testing date_isodate_set() function with an invalid values for \$object argument --\n";
32: $invalid_obj = new stdClass();
33: var_dump( date_isodate_set($invalid_obj, $year, $week, $day) );
34: $invalid_obj = 10;
35: var_dump( date_isodate_set($invalid_obj, $year, $week, $day) );
36: $invalid_obj = null;
37: var_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:
45: Warning: date_isodate_set() expects at least 3 parameters, 0 given in %s on line %d
46: bool(false)
47:
48: -- Testing date_isodate_set() function with less than expected no. of arguments --
49:
50: Warning: date_isodate_set() expects at least 3 parameters, 1 given in %s on line %d
51: bool(false)
52:
53: -- Testing date_isodate_set() function with more than expected no. of arguments --
54:
55: Warning: date_isodate_set() expects at most 4 parameters, 5 given in %s on line %d
56: bool(false)
57:
58: -- Testing date_isodate_set() function with an invalid values for $object argument --
59:
60: Warning: date_isodate_set() expects parameter 1 to be DateTime, object given in %s on line %d
61: bool(false)
62:
63: Warning: date_isodate_set() expects parameter 1 to be DateTime, integer given in %s on line %d
64: bool(false)
65:
66: Warning: date_isodate_set() expects parameter 1 to be DateTime, null given in %s on line %d
67: bool(false)
68: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>