【问题标题】:PHPUnit 3.4.15 exit if cookie getting without error如果 cookie 没有错误,PHPUnit 3.4.15 退出
【发布时间】:2013-02-28 22:39:38
【问题描述】:

如果我打电话

$guest_identity = Zend_Controller_Request_Http::getCookie('guest_identity', $key);

$COOKIE['guest_identity'];

PHPUnit 3.4.15 退出函数没有错误。如何解决?

【问题讨论】:

    标签: php zend-framework cookies phpunit


    【解决方案1】:

    如果我理解正确,上面的代码应该会引发错误或异常,但它不会。

    如果是这种情况,请根据您预期发生的错误类型使用其中一种。如果您传递函数 null 则错误处理程序将重置为默认值。

    register_shutdown_function
    set_error_handler
    set_exception_handler
    

    【讨论】:

    • 谢谢,但事实上没有记录错误,PHPUnit 只是退出并去创建报告或显示处理时间和一般统计信息。
    • 如果应该发生错误并且您执行了上述所有功能并且您 error_reporting(E_ALL);那么肯定会像在任何 php 脚本中一样发生错误。如果您遇到问题 MakeGood 是我用来调试 PHPUnit 测试用例的工具。
    猜你喜欢
    • 2014-04-18
    • 2015-01-24
    • 2011-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多