1--TEST--
2Test DateTime::setTime() function : error conditions
3--FILE--
4<?php
5/* Prototype  : public DateTime DateTime::setTime  ( int $hour  , int $minute  [, int $second  ] )
6 * Description: Resets the current time of the DateTime object to a different time.
7 * Source code: ext/date/php_date.c
8 * Alias to functions: date_time_set
9 */
10
11date_default_timezone_set("Europe/London");
12
13echo "*** Testing DateTime::setTime() : error conditions ***\n";
14
15$datetime = date_create("2009-01-31 15:34:10");
16
17echo "\n-- Testing DateTime::setTime() function with zero arguments --\n";
18var_dump( $datetime->setTime() );
19
20echo "\n-- Testing DateTime::setTime() function with less than expected no. of arguments --\n";
21$hour = 18;
22var_dump( $datetime->setTime($hour) );
23
24echo "\n-- Testing DateTime::setTime() function with more than expected no. of arguments --\n";
25$min = 15;
26$sec = 30;
27$extra_arg = 10;
28var_dump( $datetime->setTime($hour, $min, $sec, $extra_arg) );
29
30?>
31===DONE===
32--EXPECTF--
33*** Testing DateTime::setTime() : error conditions ***
34
35-- Testing DateTime::setTime() function with zero arguments --
36
37Warning: DateTime::setTime() expects at least 2 parameters, 0 given in %s on line %d
38bool(false)
39
40-- Testing DateTime::setTime() function with less than expected no. of arguments --
41
42Warning: DateTime::setTime() expects at least 2 parameters, 1 given in %s on line %d
43bool(false)
44
45-- Testing DateTime::setTime() function with more than expected no. of arguments --
46
47Warning: DateTime::setTime() expects at most 3 parameters, 4 given in %s on line %d
48bool(false)
49===DONE===
50