Weather = new WeatherHelper(new View(null)); $this->Weather->Html = new HtmlHelper(new View(null)); } /** TODO **/ public function testDisplay() { $res = $this->Weather->get('51.0872,13.8028'); $res = $this->_display($res); pr($res); $this->assertTrue(!empty($res)); echo BR.BR; $res = $this->Weather->get('Berlin, Deutschland'); $res = $this->_display($res); pr($res); $this->assertTrue(!empty($res)); echo BR.BR; $res = $this->Weather->get('Schwäbisch Hall, Deutschland'); $res = $this->_display($res); pr($res); $this->assertTrue(!empty($res)); $res = $this->Weather->get('xxxxx'); $res = $this->_display($res); pr($res); $this->assertTrue(empty($res)); echo BR.BR; } public function _display($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 .= '