date_sunrise_variation7.phpt 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. --TEST--
  2. Test date_sunrise() function : usage variation - Checking sunrise for consecutive days in specific timezone
  3. --INI--
  4. error_reporting=E_ALL&~E_DEPRECATED
  5. --FILE--
  6. <?php
  7. echo "*** Testing date_sunrise() : usage variation ***\n";
  8. //Timezones with required data for date_sunrise
  9. $inputs = array (
  10. //Timezone with Latitude, Longitude and GMT offset
  11. "Pacific/Samoa" => array ("Latitude" => -14.24, "Longitude" => -170.72, "GMT" => -11),
  12. "US/Alaska" => array ("Latitude" => 61, "Longitude" => -150 , "GMT" => -9),
  13. "America/Chicago" => array ("Latitude" => 41.85, "Longitude" => -87.65 , "GMT" => -5),
  14. "America/Montevideo" => array ("Latitude" => -34.88, "Longitude" => -56.18 , "GMT" => -3),
  15. "Africa/Casablanca" => array ("Latitude" => 33.65, "Longitude" => -7.58, "GMT" => 0),
  16. "Europe/Moscow" => array ("Latitude" => 55.75, "Longitude" => 37.58, "GMT" => 4),
  17. "Asia/Hong_Kong" => array ("Latitude" => 22.28, "Longitude" => 114.15 , "GMT" => 8),
  18. "Australia/Brisbane" => array ("Latitude" => -27.46, "Longitude" => 153.2 , "GMT" => 10),
  19. "Pacific/Wallis" => array ("Latitude" => -13.3, "Longitude" => -176.16, "GMT" => 12),
  20. );
  21. foreach($inputs as $timezone => $value) {
  22. date_default_timezone_set($timezone);
  23. $time = mktime(8, 8, 8, 8, 11, 2008);
  24. var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"] ));
  25. $time = mktime(8, 8, 8, 8, 12, 2008);
  26. var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"]) );
  27. }
  28. ?>
  29. --EXPECT--
  30. *** Testing date_sunrise() : usage variation ***
  31. string(5) "06:42"
  32. string(5) "06:41"
  33. string(5) "05:07"
  34. string(5) "05:09"
  35. string(5) "05:58"
  36. string(5) "05:59"
  37. string(5) "07:31"
  38. string(5) "07:30"
  39. string(5) "05:52"
  40. string(5) "05:53"
  41. string(5) "05:59"
  42. string(5) "06:01"
  43. string(5) "06:01"
  44. string(5) "06:02"
  45. string(5) "06:23"
  46. string(5) "06:22"
  47. string(5) "06:03"
  48. string(5) "06:02"