1 | <?php |
||
19 | class WeatherTest extends \PHPUnit_Framework_TestCase |
||
20 | { |
||
21 | /** |
||
22 | * @var Weather |
||
23 | */ |
||
24 | protected $weather; |
||
25 | |||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $description = 'thunderstorm with light rain'; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $iconName = '11d'; |
||
35 | |||
36 | protected function setUp() |
||
37 | { |
||
38 | $this->weather = new Weather(200, $this->description, $this->iconName); |
||
39 | } |
||
40 | |||
41 | public function test__toString() |
||
42 | { |
||
43 | $expectDescription = $this->description; |
||
44 | $description = $this->weather->__toString(); |
||
45 | |||
46 | $this->assertSame($expectDescription, $description); |
||
47 | } |
||
48 | |||
49 | public function testGetIconUrl() |
||
50 | { |
||
51 | $expectIconLink = '//openweathermap.org/img/w/11d.png'; |
||
52 | $weather = $this->weather; |
||
53 | $iconLink = $weather->getIconUrl(); |
||
54 | |||
55 | $this->assertSame($expectIconLink, $iconLink); |
||
56 | } |
||
57 | |||
58 | public function testSetIconUrlTemplate() |
||
67 | } |
||
68 |