Weather = new WeatherHelper(new View(null)); $this->Weather->Html = new HtmlHelper(new View(null)); $this->skipIf(!Configure::read('Weather.key')); } /** TODO **/ public function testDisplay() { $res = $this->Weather->get('51.0872,13.8028'); $res = $this->_displayForecast($res); $this->out($res); $this->assertTrue(!empty($res)); $res = $this->Weather->get('Berlin, Deutschland'); $res = $this->_displayForecast($res); $this->out($res); $this->assertTrue(!empty($res)); $res = $this->Weather->get('Schwäbisch Hall, Deutschland'); $res = $this->_displayForecast($res); $this->out($res); $this->assertTrue(!empty($res)); $res = $this->Weather->get('xxxxx'); $res = $this->_displayForecast($res); $this->assertTrue(empty($res)); } public function _displayForecast($w) { $res = ''; if (empty($w['request'])) { return $res; } $res .= '
';
$res .= ''.date('D', strtotime($weather['date'])).''; $res .= ''.date('M d, Y', strtotime($weather['date'])).' ';
$res .= ''.$this->Weather->Html->image($weather['weatherIconUrl']).''; $res .= ''.$weather['tempMinC'].'° - '.$weather['tempMaxC'].'° ';
$res .= ''.$weather['weatherDesc'].' ';
$res .= ' | ';
}
$res .= '