单元测试 ========== 单元测试验证单个代码单元是否按预期工作。 也就是说,给定不同的输入参数, 测试验证类方法返回预期结果。 单元测试通常由编写待测试类的人开发。 Yii的单元测试框架 Codeception 基于 PHPUnit,Codeception 建议遵从 PHPUnit 的文档的进行开发: - [Codeception for Yii framework](http://codeception.com/for/yii) - [Codeception Unit Tests](http://codeception.com/docs/05-UnitTests) - [PHPUnit docs starting from chapter 2](http://phpunit.de/manual/current/en/writing-tests-for-phpunit.html) ## 运行基本和高级模板测试 如果您已经开始使用高级模板,请参阅 ["testing" guide](https://github.com/yiisoft/yii2-app-advanced/blob/master/docs/guide/start-testing.md) 有关运行测试的更多细节。 如果您已经开始使用基本模板,请参阅 [README "testing" section](https://github.com/yiisoft/yii2-app-basic/blob/master/README.md#testing)。 ## 框架单元测试 如果你想运行 Yii 框架的单元测试 “[Getting started with Yii 2 development](https://github.com/yiisoft/yii2/blob/master/docs/internals/getting-started.md)”。