Skip to content

Commit

Permalink
Typo.
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed Sep 2, 2018
1 parent c7955a5 commit c3d86ed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ $response = $weather->getLiveWeather('深圳');
### 获取近期天气预报

```
$response = $weather->getForcastsWeather('深圳');
$response = $weather->getForecastsWeather('深圳');
```
示例:

Expand Down Expand Up @@ -166,7 +166,7 @@ $response = $weather->getLiveWeather('深圳', 'xml');

```
array | string getLiveWeather(string $city, string $format = 'json')
array | string getForcastsWeather(string $city, string $format = 'json')
array | string getForecastsWeather(string $city, string $format = 'json')
```

> - `$city` - 城市名/[高德地址位置 adcode](https://lbs.amap.com/api/webservice/guide/api/district),比如:“深圳” 或者(adcode:440300);
Expand Down
2 changes: 1 addition & 1 deletion src/Weather.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function getLiveWeather($city, $format = 'json')
* @throws \Overtrue\Weather\Exceptions\HttpException
* @throws \Overtrue\Weather\Exceptions\InvalidArgumentException
*/
public function getForcastsWeather($city, $format = 'json')
public function getForecastsWeather($city, $format = 'json')
{
return $this->getWeather($city, 'all', $format);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/WeatherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ public function testGetLiveWeather()
$this->assertSame(['success' => true], $w->getLiveWeather('深圳'));
}

public function testGetForcastsWeather()
public function testGetForecastsWeather()
{
// 将 getWeather 接口模拟为返回固定内容,以测试参数传递是否正确
$w = \Mockery::mock(Weather::class, ['mock-key'])->makePartial();
$w->expects()->getWeather('深圳', 'all', 'json')->andReturn(['success' => true]);

// 断言正确传参并返回
$this->assertSame(['success' => true], $w->getForcastsWeather('深圳'));
$this->assertSame(['success' => true], $w->getForecastsWeather('深圳'));
}
}

0 comments on commit c3d86ed

Please sign in to comment.