Completed
Push — master ( 20039f...d55e06 )
by Christian
14:39
created

CurrentWeatherTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testWindDirection() 0 10 1
1
<?php
2
3
/*
4
 * OpenWeatherMap-PHP-API — A PHP API to parse weather data from https://OpenWeatherMap.org.
5
 *
6
 * @license MIT
7
 *
8
 * Please see the LICENSE file distributed with this source code for further
9
 * information regarding copyright and licensing.
10
 *
11
 * Please visit the following links to read about the usage policies and the license of
12
 * OpenWeatherMap data before using this library:
13
 *
14
 * @see https://OpenWeatherMap.org/price
15
 * @see https://OpenWeatherMap.org/terms
16
 * @see https://OpenWeatherMap.org/appid
17
 */
18
19
namespace Cmfcmf\OpenWeatherMap\Tests\OpenWeatherMap;
20
21
use Cmfcmf\OpenWeatherMap\CurrentWeather;
22
use Cmfcmf\OpenWeatherMap\Tests\FakeData;
23
24
class CurrentWeatherTest extends \PHPUnit_Framework_TestCase
25
{
26
    public function testWindDirection()
27
    {
28
        $fakeXml = new \SimpleXMLElement(FakeData::CURRENT_WEATHER_XML);
29
        $weather = new CurrentWeather($fakeXml, "metric");
30
        $this->assertSame($weather->wind->direction->getValue(), 300.0);
31
32
        $fakeXml = new \SimpleXMLElement(FakeData::CURRENT_WEATHER_XML_NO_WIND_DIRECTION);
33
        $weather = new CurrentWeather($fakeXml, "metric");
34
        $this->assertNull($weather->wind->direction);
35
    }
36
}
37