Report Phpunit代码覆盖率-在测试中包括包含函数的文件时,分析0个文件

Report Phpunit代码覆盖率-在测试中包括包含函数的文件时,分析0个文件,report,phpunit,code-coverage,Report,Phpunit,Code Coverage,在尝试创建测试的代码覆盖率报告时,我得到了一个奇怪的结果 我称之为: phpunit --coverage-html report tests/JSONTest.php 得到这个: PHPUnit 3.6.12 by Sebastian Bergmann. . Time: 0 seconds, Memory: 6.75Mb OK (1 test, 1 assertion) Generating code coverage report in HTML format ... done 我的测试

在尝试创建测试的代码覆盖率报告时,我得到了一个奇怪的结果

我称之为:

phpunit --coverage-html report tests/JSONTest.php
得到这个:

PHPUnit 3.6.12 by Sebastian Bergmann.
.
Time: 0 seconds, Memory: 6.75Mb
OK (1 test, 1 assertion)
Generating code coverage report in HTML format ... done
我的测试如下所示:

<?php

require_once dirname(__FILE__) . "/../include/includeAllNecessaryFiles.php";

class JSONTest extends PHPUnit_Framework_TestCase {
    public function testBla() {
        $this->assertEquals("hallo", "hallo");
    }
}
该报告工作正常,并准确显示测试覆盖了多少行

有人有主意吗

提前谢谢


Ben

我发现代码覆盖率报告并非总是100%准确。可能有很多原因。我曾经向Derick Rethans(Xdebug的创建者)询问过这一点。他告诉我,同时使用Zend Debugger和Xdebug(我倾向于这样做)可以避免行计数

我知道这没有多大帮助,但我只是想让你知道这是一个众所周知的问题

<?php
include '/usr/share/php/PHPUnit/Framework/TestCase.php';

function something(){

}
function something(){

}