Completed
Pull Request — master (#93)
by lee
12:25
created

WeatherTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A test__toString() 0 8 1
A testGetIconUrl() 0 8 1
1
<?php
2
/**
3
 * Copyright Zikula Foundation 2014 - Zikula Application Framework
4
 *
5
 * This work is contributed to the Zikula Foundation under one or more
6
 * Contributor Agreements and licensed to You under the following license:
7
 *
8
 * @license GNU/LGPv3 (or at your option any later version).
9
 * @package OpenWeatherMap-PHP-Api
10
 *
11
 * Please see the NOTICE file distributed with this source code for further
12
 * information regarding copyright and licensing.
13
 */
14
15
namespace Cmfcmf\OpenWeatherMap\Tests\Util;
16
17
use \Cmfcmf\OpenWeatherMap\Util\Weather;
18
19
class WeatherTest extends \PHPUnit_Framework_TestCase
20
{
21
    protected $weather;
22
    protected $description = 'thunderstorm with light rain';
23
    protected $iconName = '11d';
24
25
    protected function setUp()
26
    {
27
        $this->weather = new Weather(200, $this->description, $this->iconName);
28
    }
29
30
    public function test__toString()
31
    {
32
        $expectDescription = $this->description;
33
        $weather = $this->weather;
34
        $description = $weather->__toString();
35
36
        $this->assertSame($expectDescription, $description);
37
    }
38
39
    public function testGetIconUrl()
40
    {
41
        $expectIconLink = 'http://openweathermap.org/img/w/11d.png';
42
        $weather = $this->weather;
43
        $iconLink = $weather->getIconUrl();
44
45
        $this->assertSame($expectIconLink, $iconLink);
46
    }
47
}
48