且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在代码中打印调试输出到控制台

更新时间:2022-06-25 07:41:15

我似乎通过使用帮助类找到了解决方法:

I seem to have found a way around the issue by using a helper class:

class WebHelper extends \Codeception\Module
{
    public function seeMyVar($var){
        $this->debug($var);
    }
}

并调用类:

$foo = array('one','two');
$I->seeMyVar($foo);

然后我得到调试输出我正在寻找

then I get the debug output I'm looking for

I see my var "lambda function"
  Array
  (
      [0] => one
      [1] => two
  )



我将接受这个临时解决方案保持我的断言干净,不杂乱他们与var_dumps升级到测试功能,所以如果任何人有一个概念上正确的解决方案,请提交

I will accept this as a temporary solution however I would like to keep my assertions clean and not clutter them with var_dumps upgraded to test functions, so if anyone has a conceptually correct solution, please submit