swoft icon indicating copy to clipboard operation
swoft copied to clipboard

单元测试中无法使用Log::info

Open zarte opened this issue 5 years ago • 2 comments

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;

zarte avatar Sep 09 '20 03:09 zarte

确认是使用 Log::info 导致的吗

inhere avatar Sep 09 '20 13:09 inhere

@inhere 嗯,log注释掉就可以了

zarte avatar Sep 10 '20 03:09 zarte