tp6接入phpunit单元测试问题

浏览:950 发布日期:2020/08/27 分类:求助交流 关键字: 单元测试
接入单元测试phpunit,数据库查询时,报模型基类think\Model中$db->connect()方法错误,怎么解决呢?还有日期记录Log::write()也会报错


vendor\bin\phpunit app\test\index\IndexTest.php

Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
PHPUnit 8.0.0 by Sebastian Bergmann and contributors.

Runtime: PHP 7.2.9
Configuration: D:\phpstudy_pro\WWW\bf_product\unit\admin\phpunit.xml

E 1 / 1 (100%)

Time: 113 ms, Memory: 4.00 MB

There was 1 error:

1) app\test\index\IndexTest::testHello
Error: Call to a member function connect() on null

D:\phpstudy_pro\WWW\bf_product\unit\admin\vendor\topthink\think-orm\src\Model.php:356
D:\phpstudy_pro\WWW\bf_product\unit\admin\vendor\topthink\think-orm\src\Model.php:1047
D:\phpstudy_pro\WWW\bf_product\unit\admin\app\test\index\IndexTest.php:14

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.
最佳答案
评论( 相关
后面还有条评论,点击查看>>