]> git.mxchange.org Git - friendica-addons.git/blob - curweather/vendor/cmfcmf/openweathermap-php-api/tests/Fetcher/FileGetContentsFetcherTest.php
added composer.json and needed libs
[friendica-addons.git] / curweather / vendor / cmfcmf / openweathermap-php-api / tests / Fetcher / FileGetContentsFetcherTest.php
1 <?php
2 /**
3  * OpenWeatherMap-PHP-API — A php api to parse weather data from http://www.OpenWeatherMap.org .
4  *
5  * @license MIT
6  *
7  * Please see the LICENSE file distributed with this source code for further
8  * information regarding copyright and licensing.
9  *
10  * Please visit the following links to read about the usage policies and the license of
11  * OpenWeatherMap before using this class:
12  *
13  * @see http://www.OpenWeatherMap.org
14  * @see http://www.OpenWeatherMap.org/terms
15  * @see http://openweathermap.org/appid
16  */
17
18 namespace Cmfcmf\OpenWeatherMap\Tests\Fetcher;
19
20 use \Cmfcmf\OpenWeatherMap\Fetcher\FileGetContentsFetcher;
21
22 class FileGetContentsFetcherTest extends \PHPUnit_Framework_TestCase
23 {
24     protected function setUp()
25     {
26         if (!ini_get('allow_url_fopen')) {
27             $this->markTestSkipped('"allow_url_fopen" is set to off.');
28         }
29     }
30
31     /**
32      * @expectedException \PHPUnit_Framework_Error_Warning
33      */
34     public function testInvalidUrl()
35     {
36         $fetcher = new FileGetContentsFetcher();
37
38         $fetcher->fetch('http://notexisting.example.com');
39     }
40
41     /**
42      * @expectedException \PHPUnit_Framework_Error_Warning
43      */
44     public function testEmptyUrl()
45     {
46         $fetcher = new FileGetContentsFetcher();
47
48         $fetcher->fetch('');
49     }
50
51     public function testValidUrl()
52     {
53         $fetcher = new FileGetContentsFetcher();
54
55         $content = $fetcher->fetch('http://httpbin.org/html');
56
57         $this->assertContains('Herman Melville', $content);
58     }
59 }