date_sunrise_error.phpt 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. echo "*** Testing date_sunrise() : error conditions ***\n";
  10. //Initialise the variables
  11. $time = time();
  12. $latitude = 38.4;
  13. $longitude = -9;
  14. $zenith = 90;
  15. $gmt_offset = 1;
  16. $extra_arg = 10;
  17. // Zero arguments
  18. echo "\n-- Testing date_sunrise() function with Zero arguments --\n";
  19. var_dump( date_sunrise() );
  20. //Test date_sunrise with one more than the expected number of arguments
  21. echo "\n-- Testing date_sunrise() function with more than expected no. of arguments --\n";
  22. var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset, $extra_arg) );
  23. ?>
  24. ===DONE===
  25. --EXPECTF--
  26. *** Testing date_sunrise() : error conditions ***
  27. -- Testing date_sunrise() function with Zero arguments --
  28. Warning: date_sunrise() expects at least 1 parameter, 0 given in %s on line %d
  29. bool(false)
  30. -- Testing date_sunrise() function with more than expected no. of arguments --
  31. Warning: date_sunrise() expects at most 6 parameters, 7 given in %s on line %d
  32. bool(false)
  33. ===DONE===