aogg / think-phpunit
ThinkPHP6 use PHPUnit.
v0.4.2
2024-07-26 08:36 UTC
Requires
- php: >=7.2.0 || >=8.1
- ext-json: *
- ext-pcntl: *
- phpunit/phpunit: ^7.0 || ^10.5.17
- topthink/framework: ^6.0.0
README
ThinkPHP6 use PHPUnit
ThinkPHP6使用PHPUnit
介绍
- phpunit可以给PHPStorm指定phpunit的路径
- 可以通过php think unit执行命令
- BaseTestCase是测试基类,继承phpunit的测试基类,并提供ThinkPHP6专用方法
- 继承\aogg\phpunit\think\BaseTestCase基类
- 支持项目软连接情况下运行单元测试
安装
composer require aogg/think-phpunit:^v0.3
详细
BaseTestCase
支持测试类中调用控制器的方法
/** * 商品列表 * * @return array|mixed */ public function testStoreVerifyFinishList() { $data = $this->get($this->getRequestUrlString('product/list', ['limit' => 1])); return $data; }
配置PHPStorm的PHPUnit
配置PHPStorm的远端PHPUnit
本地调试composer类库
{ "repositories": [ { "type": "path", "url": "/app/origin/my/github/composer-PHPUnit-ThinkPHP" } ] }
composer require aogg/think-phpunit:dev-master