Annotation of embedaddon/php/ext/date/tests/date_sunset_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test 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:
11: echo "*** 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
22: echo "\n-- Testing date_sunset() function with Zero arguments --\n";
23: var_dump( date_sunset() );
24:
25: //Test date_sunset with one more than the expected number of arguments
26: echo "\n-- Testing date_sunset() function with more than expected no. of arguments --\n";
27: var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset, $extra_arg) );
28: var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset, $extra_arg) );
29: var_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:
37: Warning: date_sunset() expects at least 1 parameter, 0 given in %s on line %d
38: bool(false)
39:
40: -- Testing date_sunset() function with more than expected no. of arguments --
41:
42: Warning: date_sunset() expects at most 6 parameters, 7 given in %s on line %d
43: bool(false)
44:
45: Warning: date_sunset() expects at most 6 parameters, 7 given in %s on line %d
46: bool(false)
47:
48: Warning: date_sunset() expects at most 6 parameters, 7 given in %s on line %d
49: bool(false)
50: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>