1--TEST--
2Test 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
12date_default_timezone_set("Europe/London");
13
14echo "*** Testing timezone_name_get() : error conditions ***\n";
15
16echo "\n-- Testing timezone_name_get() function with zero arguments --\n";
17var_dump( timezone_name_get() );
18
19echo "\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;
22var_dump( timezone_name_get($datetime,  $extra_arg) );
23
24echo "\n-- Testing timezone_name_get() function with an invalid values for \$object argument --\n";
25$invalid_obj = new stdClass();
26var_dump( timezone_name_get($invalid_obj) );
27$invalid_obj = 10;
28var_dump( timezone_name_get($invalid_obj) );
29$invalid_obj = null;
30var_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
38Warning: timezone_name_get() expects exactly 1 parameter, 0 given in %s on line %d
39bool(false)
40
41-- Testing date_timezone_set() function with more than expected no. of arguments --
42
43Warning: timezone_name_get() expects exactly 1 parameter, 2 given in %s on line %d
44bool(false)
45
46-- Testing timezone_name_get() function with an invalid values for $object argument --
47
48Warning: timezone_name_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d
49bool(false)
50
51Warning: timezone_name_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
52bool(false)
53
54Warning: timezone_name_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
55bool(false)
56===DONE===
57