While doing a controller test method, and running dispatch method I find it echos the output,
How can I capture that output instead of printing it to the commandline?
While doing a controller test method, and running dispatch method I find it echos the output,
How can I capture that output instead of printing it to the commandline?
You can use built-in support in PHPUnit: http://phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.output
Edited from the old answer mentioning output buffering.