单元测试phpunit版本太低

浏览:773 发布日期:2019/02/20
5.0.0 - 普通 - 未处理
1、单元测试依赖的phpunit版本是4.8.*的版本太低,里面用的的each()函数在php7.2已经被废弃了;

2、当执行测试过程中遇到结果返回Error错误时,程序会抛出:
TypeError: Argument 1 passed to think\exception\Handle::render() must be an instance of Exception, instance of Error given, called in /xxx/vendor/topthink/think-testing/src/CrawlerTrait.php on line 85

3、模拟上传时,若先设置上传文件,request()->file('file')处理时会出现判断错误:
$mock = ['tmp_name' => 'xxxxx', 'size' => 11, 'error' => 0......];
$file = new \think\File($mock['tmp_name']);
$file->setUploadInfo($mock);
$file->isTest(true);
$result = $this->makeRequest('POST', 'uri', [], [], ['file' => $file])->response->getData();
错误信息:
Array
(
[message] => Cannot use object of type think\File as array
[file] => /xxx/thinkphp/library/think/Request.php
[line] => 898
)


评论(
后面还有条评论,点击查看>>