1--TEST-- 2Test date_sunset() function : error conditions 3--FILE-- 4<?php 5/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]]) 6 * Description: Returns time of sunset for a given day and location 7 * Source code: ext/date/php_date.c 8 * Alias to functions: 9 */ 10 11echo "*** Testing date_sunset() : error conditions ***\n"; 12 13//Initialise the variables 14$time = time(); 15$latitude = 38.4; 16$longitude = -9; 17$zenith = 90; 18$gmt_offset = 1; 19$extra_arg = 10; 20 21// Zero arguments 22echo "\n-- Testing date_sunset() function with Zero arguments --\n"; 23var_dump( date_sunset() ); 24 25//Test date_sunset with one more than the expected number of arguments 26echo "\n-- Testing date_sunset() function with more than expected no. of arguments --\n"; 27var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset, $extra_arg) ); 28var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset, $extra_arg) ); 29var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset, $extra_arg) ); 30?> 31===DONE=== 32--EXPECTF-- 33*** Testing date_sunset() : error conditions *** 34 35-- Testing date_sunset() function with Zero arguments -- 36 37Warning: date_sunset() expects at least 1 parameter, 0 given in %s on line %d 38bool(false) 39 40-- Testing date_sunset() function with more than expected no. of arguments -- 41 42Warning: date_sunset() expects at most 6 parameters, 7 given in %s on line %d 43bool(false) 44 45Warning: date_sunset() expects at most 6 parameters, 7 given in %s on line %d 46bool(false) 47 48Warning: date_sunset() expects at most 6 parameters, 7 given in %s on line %d 49bool(false) 50===DONE=== 51