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; 28$microseconds = 123123; 29var_dump( $datetime->setTime($hour, $min, $sec, $microseconds, $extra_arg) ); 30 31?> 32===DONE=== 33--EXPECTF-- 34*** Testing DateTime::setTime() : error conditions *** 35 36-- Testing DateTime::setTime() function with zero arguments -- 37 38Warning: DateTime::setTime() expects at least 2 parameters, 0 given in %s on line %d 39bool(false) 40 41-- Testing DateTime::setTime() function with less than expected no. of arguments -- 42 43Warning: DateTime::setTime() expects at least 2 parameters, 1 given in %s on line %d 44bool(false) 45 46-- Testing DateTime::setTime() function with more than expected no. of arguments -- 47 48Warning: DateTime::setTime() expects at most 4 parameters, 5 given in %s on line %d 49bool(false) 50===DONE=== 51