【问题标题】:PHPUnit output with header exceptions (--stderr no result)带有标头异常的 PHPUnit 输出(--stderr 无结果)
【发布时间】:2012-12-14 09:20:43
【问题描述】:

使用 zend 和 phpunit 进行测试时。控制台上显示标题错误。 我发现错误:

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 选项时,我找不到测试用例的一些输出和报告。 这是控制台上的输出:

root@ubuntu:/home/boingonline/www/testunit# phpunit --stderr
PHPUnit 3.5.15 by Sebastian Bergmann.

root@ubuntu:/home/boingonline/www/testunit# 

对这个问题有什么想法吗?谢谢大家的回答。

【问题讨论】:

    标签: unit-testing zend-framework testing phpunit


    【解决方案1】:

    这是bug in PHP。每当输出某些内容时(即使在 CLI 上,这就是问题所在),您不能再使用 header() 调用。

    一种解决方法是使用@runInSeparateProcess 进行测试的进程隔离。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-29
    • 2023-03-27
    • 1970-01-01
    • 2018-03-03
    相关资源
    最近更新 更多