1.下载yii框架
composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic
2.yii 自带Codeception
测试框架,并预装了基本和高级项目模板。 也可自行安装
composer require codeception/codeception
composer require codeception/specify
composer require codeception/verify
3.运行
php vendor/bin/codecept build
4.创建一个测试用例
php vendor/bin/codecept generate:test unit Example
5.运行此测试用例
php vendor/bin/codecept run unit ExampleTest
6.关于单元测试详情:请参看教程
http://www.kkh86.com/it/codeception/guide-unit-test-create.html