I just ran into an unusual problem: While testing controllers in Zend using PHPUnit, all of a sudden all occurrences of var_dump() placed in Controllers stopped working. In models and test-class开发者_开发知识库es, they still show up, and when I navigate to the specified controller with a browser, all var_dumps are executed.
I'm completely at a loss here, does anyone know how I can fix this? Thanks in advance.
I think the problem is, that the output is buffered.
You could do this in your Controller:
error_log(print_r($var, true)); // instead of var_dump
or this in your test case:
$return = $this->getFrontController()->getResponse()->getBody();
var_dump($return);
Or you can try my "extended debug" class and use dd($something);
;)
https://github.com/tomasfejfar/enhanced-dump/blob/master/fnc.php
精彩评论