Reputation: 537
When testing with zend & phpunit. Header error show on console. I find the error:
Cannot modify header information - headers already sent by (output started at /usr/share/php/PHPUnit/Util/Printer.php:173)
I try to debug with the instructions in some topic Is there a way test STDERR output in PHPUnit? and PHPUnit output causing Zend_Session exceptions. But when use --stderr option, I can not find some output and report of testcase. This is the output on the console:
root@ubuntu:/home/boingonline/www/testunit# phpunit --stderr
PHPUnit 3.5.15 by Sebastian Bergmann.
root@ubuntu:/home/boingonline/www/testunit#
Any ideas for this problem? Thanks for all answers.
Upvotes: 2
Views: 2567
Reputation: 31078
This is a bug in PHP. Whenever something is output (even on CLI, that's the problem), you cannot use header()
calls anymore.
A workaround is to use process isolation for the test with @runInSeparateProcess
.
Upvotes: 5