Annotation of embedaddon/php/ext/date/tests/date_sunrise_error.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test date_sunrise() function : error conditions
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
! 6: * Description: Returns time of sunrise for a given day and location
! 7: * Source code: ext/date/php_date.c
! 8: */
! 9:
! 10: echo "*** Testing date_sunrise() : error conditions ***\n";
! 11:
! 12: //Initialise the variables
! 13: $time = time();
! 14: $latitude = 38.4;
! 15: $longitude = -9;
! 16: $zenith = 90;
! 17: $gmt_offset = 1;
! 18: $extra_arg = 10;
! 19:
! 20: // Zero arguments
! 21: echo "\n-- Testing date_sunrise() function with Zero arguments --\n";
! 22: var_dump( date_sunrise() );
! 23:
! 24: //Test date_sunrise with one more than the expected number of arguments
! 25: echo "\n-- Testing date_sunrise() function with more than expected no. of arguments --\n";
! 26: var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset, $extra_arg) );
! 27: ?>
! 28: ===DONE===
! 29: --EXPECTF--
! 30: *** Testing date_sunrise() : error conditions ***
! 31:
! 32: -- Testing date_sunrise() function with Zero arguments --
! 33:
! 34: Warning: date_sunrise() expects at least 1 parameter, 0 given in %s on line %d
! 35: bool(false)
! 36:
! 37: -- Testing date_sunrise() function with more than expected no. of arguments --
! 38:
! 39: Warning: date_sunrise() expects at most 6 parameters, 7 given in %s on line %d
! 40: bool(false)
! 41: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>