aogg / think-phpunit
ThinkPHP6 使用 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 使用 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