WeatherLibTest.php 879 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. App::uses('WeatherLib', 'Tools.Lib');
  3. App::uses('MyCakeTestCase', 'Tools.TestSuite');
  4. class WeatherLibTest extends MyCakeTestCase {
  5. public function setUp() {
  6. Configure::write('Weather.key', '598dfbdaeb121715111208');
  7. App::uses('WeatherLib', 'Tools.Lib');
  8. $this->Weather = new WeatherLib();
  9. }
  10. public function testUrl() {
  11. $res = $this->Weather->_url('x.xml');
  12. $this->assertEquals('http://free.worldweatheronline.com/feed/x.xml', $res);
  13. $res = $this->Weather->_url('x.xml', array('y'=>'z'));
  14. $this->assertEquals('http://free.worldweatheronline.com/feed/x.xml?y=z', $res);
  15. }
  16. public function testWeatherConditions() {
  17. $res = $this->Weather->conditions();
  18. $this->out($res);
  19. $this->assertTrue(!empty($res));
  20. }
  21. public function testWeather() {
  22. $res = $this->Weather->get('48.2,11.1');
  23. $this->out($res);
  24. $this->assertTrue(!empty($res));
  25. }
  26. }