2012-12-14 32 views
1

當使用zend & phpunit測試時。標題錯誤顯示在控制檯上。 我找到錯誤:PHPUnit輸出與標題例外(--stderr沒有結果)

Cannot modify header information - headers already sent by (output started at /usr/share/php/PHPUnit/Util/Printer.php:173) 

我嘗試在一些話題 Is there a way test STDERR output in PHPUnit?PHPUnit output causing Zend_Session exceptions指示進行調試。 但是,當使用--stderr選項時,我找不到一些輸出和測試用例的報告。 這是在控制檯上輸出:

[email protected]:/home/boingonline/www/testunit# phpunit --stderr 
PHPUnit 3.5.15 by Sebastian Bergmann. 

[email protected]:/home/boingonline/www/testunit# 

對於這個問題的任何想法?感謝所有的答案。

回答

4

這是一個bug in PHP。無論何時輸出(即使在CLI中,這都是問題),您不能再使用header()調用。

解決方法是使用進程隔離與@runInSeparateProcess進行測試。