asset -> assert
修改理由:
相关信息:
- 类型:教程文章
- 文章: 编写单元测试
- 课程: 《LX2 PHP 扩展包实战教程 - 从入门到发布()》
此投稿已在 7年前 合并。
内容修改:
| Old | New | Differences |
|---|---|---|
| 159 | 159 | |
| 160 | 160 | $w->getWeather('深圳', 'foo'); |
| 161 | 161 | |
| 162 | $this->fail('Faild to asse | |
| 162 | $this->fail('Faild to assert getWeather throw exception with invalid argument.'); | |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // 检查 $format 参数 | … | … |
| 177 | 177 | $w->getWeather('深圳', 'base', 'array'); |
| 178 | 178 | |
| 179 | 179 | // 如果没有抛出异常,就会运行到这行,标记当前测试没成功 |
| 180 | $this->fail('Faild to asse | |
| 180 | $this->fail('Faild to assert getWeather throw exception with invalid argument.'); | |
| 181 | 181 | } |
| 182 | 182 | . |
| 183 | 183 | . | … | … |
| 448 | 448 | |
| 449 | 449 | $w->getWeather('深圳', 'foo'); |
| 450 | 450 | |
| 451 | $this->fail('Faild to asse | |
| 451 | $this->fail('Faild to assert getWeather throw exception with invalid argument.'); | |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | public function testGetWeatherWithInvalidFormat() | … | … |
| 460 | 460 | |
| 461 | 461 | $w->getWeather('深圳', 'base', 'array'); |
| 462 | 462 | |
| 463 | $this->fail('Faild to asse | |
| 463 | $this->fail('Faild to assert getWeather throw exception with invalid argument.'); | |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | public function testGetWeather() |
关于 LearnKu