Completed
Push — peter279k-master ( fcaf21 )
by Christian
13:01
created

WeatherTest::test__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
nc 1
cc 1
eloc 5
nop 0
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 = '//openweathermap.org/img/w/11d.png';
42
        $weather = $this->weather;
43
        $iconLink = $weather->getIconUrl();
44
45
        $this->assertSame($expectIconLink, $iconLink);
46
    }
47
}
48