Completed
Push — master ( 2a0a89...468a99 )
by Christian
02:41
created

CurlFetcherTest::testValidUrl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4286
cc 1
eloc 4
nc 1
nop 0
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\CurlFetcher;
21
22
/**
23
 * @requires function curl_version
24
 */
25
class CurlFetcherTest extends \PHPUnit_Framework_TestCase
26
{
27
    public function testInvalidUrl()
28
    {
29
        $fetcher = new CurlFetcher();
30
31
        $content = $fetcher->fetch('http://notexisting.example.com');
32
33
        $this->assertSame(false, $content);
34
    }
35
36
    public function testEmptyUrl()
37
    {
38
        $fetcher = new CurlFetcher();
39
40
        $content = $fetcher->fetch('');
41
42
        $this->assertSame(false, $content);
43
    }
44
45
    public function testValidUrl()
46
    {
47
        $fetcher = new CurlFetcher();
48
49
        $content = $fetcher->fetch('http://httpbin.org/html');
50
51
        $this->assertContains('Herman Melville', $content);
52
    }
53
}
54