Skip to content
Snippets Groups Projects
Commit 172aa72f authored by Dr. Tobias Quathamer's avatar Dr. Tobias Quathamer
Browse files

Fix failing tests

parent f867478a
No related branches found
No related tags found
No related merge requests found
......@@ -68,14 +68,14 @@ class WeatherFunctionsTestCase extends DrupalWebTestCase {
$this->assertEqual($link, 'weather/Côte_d’Ivoire/Worodougou/Séguéla/u');
// Test different numbers for yr links.
$link = _weather_get_link_for_geoid('geonames_2596934', 'yr');
$this->assertEqual($link, 'http://www.yr.no/place/C%C3%B4te_d%E2%80%99Ivoire/Worodougou/S%C3%A9gu%C3%A9la/forecast.xml');
$this->assertEqual($link, 'https://www.yr.no/place/C%C3%B4te_d%E2%80%99Ivoire/Worodougou/S%C3%A9gu%C3%A9la/forecast.xml');
$link = _weather_get_link_for_geoid('geonames_2596934', 'yr', 8);
$this->assertEqual($link, 'http://www.yr.no/place/C%C3%B4te_d%E2%80%99Ivoire/Worodougou/S%C3%A9gu%C3%A9la/forecast.xml');
$this->assertEqual($link, 'https://www.yr.no/place/C%C3%B4te_d%E2%80%99Ivoire/Worodougou/S%C3%A9gu%C3%A9la/forecast.xml');
// Test different numbers for yr.no links.
$link = _weather_get_link_for_geoid('geonames_2596934', 'yr.no');
$this->assertEqual($link, 'http://www.yr.no/place/Côte_d’Ivoire/Worodougou/Séguéla/');
$this->assertEqual($link, 'https://www.yr.no/place/Côte_d’Ivoire/Worodougou/Séguéla/');
$link = _weather_get_link_for_geoid('geonames_2596934', 'yr.no', 8);
$this->assertEqual($link, 'http://www.yr.no/place/Côte_d’Ivoire/Worodougou/Séguéla/');
$this->assertEqual($link, 'https://www.yr.no/place/Côte_d’Ivoire/Worodougou/Séguéla/');
// Test autocomplete link.
$link = _weather_get_link_for_geoid('geonames_2596934', 'autocomplete');
$this->assertEqual($link, 'Côte_d’Ivoire/Worodougou/Séguéla');
......
......
......@@ -335,7 +335,7 @@ function weather_get_weather($geoid, $days = 0, $detailed = TRUE) {
)->fetchAssoc();
$current_utc_time = gmdate('Y-m-d H:i:s', $time);
// If the next scheduled download is due, try to get forecasts.
if ($current_utc_time >= $meta['next_download_attempt']) {
if (($meta === FALSE) or ($current_utc_time >= $meta['next_download_attempt'])) {
$result = _weather_download_forecast($geoid);
// If that worked, get the next scheduled update time.
$meta = db_query(
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment