swoft
swoft copied to clipboard
单元测试中无法使用Log::info
php test/run.php -c phpunit.xml
异常:RuntimeException: context information has been lost of the coID: 1
···
test文件:
$bean = bean(DelFileLogic::class);
$this->assertSame(1, $bean->delMulSearchFile(),'删除文件失败');
logic:
try{
....
}catch (\Exception $e){
CLog::info($e->getMessage(), date('Y-m-d H:i:s'));
//Log::info("delMulSearchFile fail:".$e->getMessage());
return false;
}
//Log::info("delfile num:".$this->fileNum);
return $this->fileNum;
确认是使用 Log::info 导致的吗
@inhere 嗯,log注释掉就可以了