easy-yii / easy-yii.github.io

0 stars 0 forks source link

Yii2-unitTest #1

Open YuanLianDu opened 7 years ago

tranch commented 7 years ago

PHP 的 built-in web server 有个 -t 参数可以指定 document root 的路径的,比如这里就可以写成:

php -S localhost:8080 -t web

这样就能省掉 URL 中的 /web/index.php 这部分了。

Jarvie789 commented 6 years ago

单元测试文件,现在不能引入外部的类了吗?引入就会报错,这个外部的类是自己封装的: [TypeError] Argument 1 passed to PHPUnit_Framework_TestCase::onNotSuccessfulTest() must be an instance of Exception, instance of Error given, called in C:\Users\qiutianjia\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\Fra mework\TestCase.php on line 851 不去引入的话运行测试文件就是正常的。开发环境:php7,yii2,codecept2.1,win10