3 * OpenWeatherMap-PHP-API — A php api to parse weather data from http://www.OpenWeatherMap.org .
7 * Please see the LICENSE file distributed with this source code for further
8 * information regarding copyright and licensing.
10 * Please visit the following links to read about the usage policies and the license of
11 * OpenWeatherMap before using this class:
13 * @see http://www.OpenWeatherMap.org
14 * @see http://www.OpenWeatherMap.org/terms
15 * @see http://openweathermap.org/appid
18 namespace Cmfcmf\OpenWeatherMap\Tests\Fetcher;
20 use \Cmfcmf\OpenWeatherMap\Fetcher\FileGetContentsFetcher;
22 class FileGetContentsFetcherTest extends \PHPUnit_Framework_TestCase
24 protected function setUp()
26 if (!ini_get('allow_url_fopen')) {
27 $this->markTestSkipped('"allow_url_fopen" is set to off.');
32 * @expectedException \PHPUnit_Framework_Error_Warning
34 public function testInvalidUrl()
36 $fetcher = new FileGetContentsFetcher();
38 $fetcher->fetch('http://notexisting.example.com');
42 * @expectedException \PHPUnit_Framework_Error_Warning
44 public function testEmptyUrl()
46 $fetcher = new FileGetContentsFetcher();
51 public function testValidUrl()
53 $fetcher = new FileGetContentsFetcher();
55 $content = $fetcher->fetch('http://httpbin.org/html');
57 $this->assertContains('Herman Melville', $content);