|
@@ 103-113 (lines=11) @@
|
| 100 |
|
* @expectedException \Savchenko\Bundle\OpenWeatherMapBundle\Exception\BadRequestException |
| 101 |
|
* @expectedExceptionMessage You doesn't set APPID parameter or it has incorrect value |
| 102 |
|
*/ |
| 103 |
|
public function testAppIdProblem() |
| 104 |
|
{ |
| 105 |
|
$this->overrideClientGetMethod( |
| 106 |
|
'Invalid API key. Please see http://openweathermap.org/faq#error401 for more info.', |
| 107 |
|
401 |
| 108 |
|
); |
| 109 |
|
|
| 110 |
|
$this->currentWeatherData = new CurrentWeatherData('abc', $this->client); |
| 111 |
|
|
| 112 |
|
$this->currentWeatherData->loadByCityName('London'); |
| 113 |
|
} |
| 114 |
|
|
| 115 |
|
/** |
| 116 |
|
* @expectedException \Savchenko\Bundle\OpenWeatherMapBundle\Exception\BadRequestException |
|
@@ 119-126 (lines=8) @@
|
| 116 |
|
* @expectedException \Savchenko\Bundle\OpenWeatherMapBundle\Exception\BadRequestException |
| 117 |
|
* @expectedExceptionMessage Data available only on commercial terms |
| 118 |
|
*/ |
| 119 |
|
public function testPaidFeatures() |
| 120 |
|
{ |
| 121 |
|
$this->overrideClientGetMethod('', 403); |
| 122 |
|
|
| 123 |
|
$this->currentWeatherData = new CurrentWeatherData('abc', $this->client); |
| 124 |
|
|
| 125 |
|
$this->currentWeatherData->loadByCityName('London'); |
| 126 |
|
} |
| 127 |
|
|
| 128 |
|
/** |
| 129 |
|
* @expectedException \GuzzleHttp\Exception\ClientException |
|
@@ 131-138 (lines=8) @@
|
| 128 |
|
/** |
| 129 |
|
* @expectedException \GuzzleHttp\Exception\ClientException |
| 130 |
|
*/ |
| 131 |
|
public function testCatchNonExpectedException() |
| 132 |
|
{ |
| 133 |
|
$this->overrideClientGetMethod('', 404); |
| 134 |
|
|
| 135 |
|
$this->currentWeatherData = new CurrentWeatherData('abc', $this->client); |
| 136 |
|
|
| 137 |
|
$this->currentWeatherData->loadByCityName('London'); |
| 138 |
|
} |
| 139 |
|
|
| 140 |
|
public function testLoadByCityNameWithoutCountry() |
| 141 |
|
{ |