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

CurlFetcherTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 29
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testInvalidUrl() 0 8 1
A testEmptyUrl() 0 8 1
A testValidUrl() 0 8 1
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