| @@ 24-36 (lines=13) @@ | ||
| 21 | class YahooWeatherClientTests extends TestCase |
|
| 22 | { |
|
| 23 | /** @test */ |
|
| 24 | public function testCallApiWoeidException() |
|
| 25 | { |
|
| 26 | $service = new YahooWeatherAPI(); |
|
| 27 | ||
| 28 | $this->expectException(\Exception::class); |
|
| 29 | ||
| 30 | try { |
|
| 31 | $response = $service->callApiWoeid(null); |
|
| 32 | } catch (\Exception $e) { |
|
| 33 | throw $e; |
|
| 34 | } |
|
| 35 | } |
|
| 36 | ||
| 37 | /** @test */ |
|
| 38 | public function testCallApiCityNameException() |
|
| 39 | { |
|
| @@ 38-50 (lines=13) @@ | ||
| 35 | } |
|
| 36 | ||
| 37 | /** @test */ |
|
| 38 | public function testCallApiCityNameException() |
|
| 39 | { |
|
| 40 | $service = new YahooWeatherAPI(); |
|
| 41 | ||
| 42 | $this->expectException(\Exception::class); |
|
| 43 | ||
| 44 | try { |
|
| 45 | $response = $service->callApiCityName(null); |
|
| 46 | } catch (\Exception $e) { |
|
| 47 | throw $e; |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| 51 | /** @test */ |
|
| 52 | public function testCallApiTestException() |
|
| 53 | { |
|
| @@ 52-64 (lines=13) @@ | ||
| 49 | } |
|
| 50 | ||
| 51 | /** @test */ |
|
| 52 | public function testCallApiTestException() |
|
| 53 | { |
|
| 54 | $service = new YahooWeatherAPI(); |
|
| 55 | ||
| 56 | $this->expectException(\Exception::class); |
|
| 57 | ||
| 58 | try { |
|
| 59 | $response = $service->callApi(null); |
|
| 60 | } catch (\Exception $e) { |
|
| 61 | throw $e; |
|
| 62 | } |
|
| 63 | } |
|
| 64 | ||
| 65 | /** @test */ |
|
| 66 | public function testCallApiLastRes() |
|
| 67 | { |
|
| @@ 66-80 (lines=15) @@ | ||
| 63 | } |
|
| 64 | ||
| 65 | /** @test */ |
|
| 66 | public function testCallApiLastRes() |
|
| 67 | { |
|
| 68 | $errYql = 'https://query.yahooapis.com/v1/public/yql?q=from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text=%22Taipei%22)&format=json&env=store://datatables.org/alltableswithkeys'; |
|
| 69 | ||
| 70 | $service = new YahooWeatherAPI(); |
|
| 71 | ||
| 72 | $this->expectException(\Exception::class); |
|
| 73 | ||
| 74 | try { |
|
| 75 | $response = $service->callApi($errYql); |
|
| 76 | } catch (\Exception $e) { |
|
| 77 | throw $e; |
|
| 78 | } |
|
| 79 | } |
|
| 80 | ||
| 81 | /** @test */ |
|
| 82 | public function setClientTest() |
|
| 83 | { |
|