【问题标题】:Nothing happens when i try to get code coverage for my Unit test with PHPUnit当我尝试使用 PHPUnit 为我的单元测试获取代码覆盖率时,什么也没有发生
【发布时间】:2012-03-12 16:29:29
【问题描述】:

我写了一些测试,我想用 PHPUnit 3.6 RC 4 和 PHP 5.3.6 生成单元测试,但什么也没发生:

phpunit --bootstrap Bootstrap.php --coverage-html ./tmp library/plugins/PluginTest.php 

PHPUnit 3.6.0RC4 by Sebastian Bergmann.

...

Time: 0 seconds, Memory: 14.75Mb
OK (3 tests, 10 assertions)

它什么也没说 我检查了 xdebug 是否启用,这是我的 xdebug.ini :

zend_extension=/usr/lib/php5/20090626/xdebug.so
xdebug.remote_enable=on
xdebug.default_enable=on
xdebug.remote_autostart=on
xdebug.remote_host=127.0.0.1,192.168.0/24,10.37.129.2,10.211.55.2

所以我想知道会发生什么,它是在 Bootstrap 文件中吗?

【问题讨论】:

    标签: php unit-testing testing phpunit


    【解决方案1】:

    您正在运行一个非常旧版本的PHPUnit 3.6。目前是3.6.10,已经修复了半年多:)

    非常早期版本的 PHPUnit 3.6 存在已修复的代码覆盖率问题,您可能会遇到其中之一。

    当无法生成代码覆盖率时,更成熟的 3.6 版本也会为您提供正确的错误消息。

    所以我的回答是:升级,在 95% 的情况下问题会消失,或者 phpunit 会告诉你为什么它不起作用。

    【讨论】:

    • 这很奇怪,我在发布之前进行了梨升级。现在它已经修复了。谢谢你的提示。
    猜你喜欢
    • 2012-01-18
    • 2021-09-18
    • 1970-01-01
    • 2011-04-16
    • 1970-01-01
    • 2017-12-20
    • 1970-01-01
    • 2010-10-14
    相关资源
    最近更新 更多