1--TEST--
2Test DateTime::setTimezone () function : error conditions
3--FILE--
4<?php
5/* Prototype  : public DateTime DateTime::setTimezone  ( DateTimeZone $timezone  )
6 * Description: Sets the time zone for the DateTime object
7 * Source code: ext/date/php_date.c
8 * Alias to functions: date_timezone_set
9 */
10
11date_default_timezone_set("UTC");
12
13echo "*** Testing DateTime::setTimezone () : error conditions ***\n";
14
15$datetime = new DateTime("2009-01-30 17:57:32");
16
17echo "\n-- Testing DateTime::setTimezone () function with zero arguments --\n";
18var_dump( $datetime->setTimezone() );
19
20echo "\n-- Testing DateTime::setTimezone () function with more than expected no. of arguments --\n";
21$timezone  = new DateTimezone("GMT");
22$extra_arg = 99;
23var_dump( $datetime->setTimezone($timezone, $extra_arg) );
24
25?>
26===DONE===
27--EXPECTF--
28*** Testing DateTime::setTimezone () : error conditions ***
29
30-- Testing DateTime::setTimezone () function with zero arguments --
31
32Warning: DateTime::setTimezone() expects exactly 1 parameter, 0 given in %s on line %d
33bool(false)
34
35-- Testing DateTime::setTimezone () function with more than expected no. of arguments --
36
37Warning: DateTime::setTimezone() expects exactly 1 parameter, 2 given in %s on line %d
38bool(false)
39===DONE===
40