1--TEST--
2Test timezone_transitions_get() function : error conditions
3--FILE--
4<?php
5/* Prototype  : array timezone_transitions_get  ( DateTimeZone $object, [ int $timestamp_begin  [, int $timestamp_end  ]]  )
6 * Description: Returns all transitions for the timezone
7 * Source code: ext/date/php_date.c
8 * Alias to functions: DateTimeZone::getTransitions()
9 */
10
11//Set the default time zone
12date_default_timezone_set("GMT");
13$tz = timezone_open("Europe/London");
14
15echo "*** Testing timezone_transitions_get() : error conditions ***\n";
16
17echo "\n-- Testing timezone_transitions_get() function with zero arguments --\n";
18var_dump( timezone_transitions_get() );
19
20echo "\n-- Testing timezone_transitions_get() function with more than expected no. of arguments --\n";
21$timestamp_begin = mktime(0, 0, 0, 1, 1, 1972);
22$timestamp_end = mktime(0, 0, 0, 1, 1, 1975);
23$extra_arg = 99;
24var_dump( timezone_transitions_get($tz, $timestamp_begin, $timestamp_end, $extra_arg) );
25
26echo "\n-- Testing timezone_transitions_get() function with an invalid values for \$object argument --\n";
27$invalid_obj = new stdClass();
28var_dump( timezone_transitions_get($invalid_obj) );
29$invalid_obj = 10;
30var_dump( timezone_transitions_get($invalid_obj) );
31$invalid_obj = null;
32var_dump( timezone_transitions_get($invalid_obj) );
33?>
34===DONE===
35--EXPECTF--
36*** Testing timezone_transitions_get() : error conditions ***
37
38-- Testing timezone_transitions_get() function with zero arguments --
39
40Warning: timezone_transitions_get() expects at least 1 parameter, 0 given in %s on line %d
41bool(false)
42
43-- Testing timezone_transitions_get() function with more than expected no. of arguments --
44
45Warning: timezone_transitions_get() expects at most 3 parameters, 4 given in %s on line %d
46bool(false)
47
48-- Testing timezone_transitions_get() function with an invalid values for $object argument --
49
50Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d
51bool(false)
52
53Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
54bool(false)
55
56Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
57bool(false)
58===DONE===
59