标签: cakephp cakephp-2.3
如果您正在对模型进行单元测试,例如,在该模型中,您使用CakePHP的CakeLog便捷方法(可能测试预期的异常等):
CakeLog::warning('This is a warning');
Cake不仅会在测试期间在命令行输出,还会将错误添加到logs / error.log中。
我需要完成以下两件事之一:
精明的CakePHP开发人员如何完成这两件事之一?
相关:Using DB logging and doing said logging to your test database where such a thing wouldn't bother you...
答案 0 :(得分:3)
在测试的顶部,将CakeLog::drop(logger_name);添加到disable logging on the logger_name流
CakeLog::drop(logger_name);