Annotation of embedaddon/php/ext/date/tests/DateTime_setTime_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test 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:
11: date_default_timezone_set("Europe/London");
12:
13: echo "*** Testing DateTime::setTime() : error conditions ***\n";
14:
15: $datetime = date_create("2009-01-31 15:34:10");
16:
17: echo "\n-- Testing DateTime::setTime() function with zero arguments --\n";
18: var_dump( $datetime->setTime() );
19:
20: echo "\n-- Testing DateTime::setTime() function with less than expected no. of arguments --\n";
21: $hour = 18;
22: var_dump( $datetime->setTime($hour) );
23:
24: echo "\n-- Testing DateTime::setTime() function with more than expected no. of arguments --\n";
25: $min = 15;
26: $sec = 30;
27: $extra_arg = 10;
28: var_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:
37: Warning: DateTime::setTime() expects at least 2 parameters, 0 given in %s on line %d
38: bool(false)
39:
40: -- Testing DateTime::setTime() function with less than expected no. of arguments --
41:
42: Warning: DateTime::setTime() expects at least 2 parameters, 1 given in %s on line %d
43: bool(false)
44:
45: -- Testing DateTime::setTime() function with more than expected no. of arguments --
46:
47: Warning: DateTime::setTime() expects at most 3 parameters, 4 given in %s on line %d
48: bool(false)
49: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>