TP6怎么使用PHPUnit做单元测试

浏览:2494 发布日期:2020/06/28 分类:ThinkPHP6专区
PHP新手,试着用composer在TP6里装了PHPUnit,写了个简单的Model的测试用例,报错:

PHPUnit 7.0.0 by Sebastian Bergmann and contributors.

E 1 / 1 (100%)

Time: 1.73 seconds, Memory: 4.00 MB

There was 1 error:

1) test\common\model\UserStoreinfoTest::testgetByID
Error: Call to a member function connect() on null

D:\xxxxxxxx\vendor\topthink\think-orm\src\Model.php:356
D:\xxxxxxxx\vendor\topthink\think-orm\src\Model.php:1057
D:\xxxxxxxx\test\common\model\UserStoreinfoTest.php:15

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.

请教是哪里配置不对,导致拿不到数据库连接吗?
在Controller里调用那个model运行是正常的
最佳答案
评论( 相关
后面还有条评论,点击查看>>