Annotation of embedaddon/php/ext/date/tests/timezone_name_get_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test timezone_name_get() function : error conditions
3: --FILE--
4: <?php
5: /* Prototype : string timezone_name_get ( DateTime $object )
6: * Description: Returns the name of the timezone
7: * Source code: ext/date/php_date.c
8: * Alias to functions: DateTimeZone::getName()
9: */
10:
11: // Set timezone
12: date_default_timezone_set("Europe/London");
13:
14: echo "*** Testing timezone_name_get() : error conditions ***\n";
15:
16: echo "\n-- Testing timezone_name_get() function with zero arguments --\n";
17: var_dump( timezone_name_get() );
18:
19: echo "\n-- Testing date_timezone_set() function with more than expected no. of arguments --\n";
20: $datetime = date_create("2009-01-30 17:57:32");
21: $extra_arg = 99;
22: var_dump( timezone_name_get($datetime, $extra_arg) );
23:
24: echo "\n-- Testing timezone_name_get() function with an invalid values for \$object argument --\n";
25: $invalid_obj = new stdClass();
26: var_dump( timezone_name_get($invalid_obj) );
27: $invalid_obj = 10;
28: var_dump( timezone_name_get($invalid_obj) );
29: $invalid_obj = null;
30: var_dump( timezone_name_get($invalid_obj) );
31: ?>
32: ===DONE===
33: --EXPECTF--
34: *** Testing timezone_name_get() : error conditions ***
35:
36: -- Testing timezone_name_get() function with zero arguments --
37:
38: Warning: timezone_name_get() expects exactly 1 parameter, 0 given in %s on line %d
39: bool(false)
40:
41: -- Testing date_timezone_set() function with more than expected no. of arguments --
42:
43: Warning: timezone_name_get() expects exactly 1 parameter, 2 given in %s on line %d
44: bool(false)
45:
46: -- Testing timezone_name_get() function with an invalid values for $object argument --
47:
48: Warning: timezone_name_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d
49: bool(false)
50:
51: Warning: timezone_name_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
52: bool(false)
53:
54: Warning: timezone_name_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
55: bool(false)
56: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>