命名空间代码未包含在覆盖范围内

命名空间代码未包含在覆盖范围内

本文介绍了命名空间代码未包含在覆盖范围内的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是phpunit.xml:

<phpunit
        bootstrap="bootstrap.php"
        colors="false"
        convertErrorsToExceptions="true"
        convertNoticesToExceptions="true"
        convertWarningsToExceptions="true"
        stopOnFailure="false"
        stopOnError="false"
        stopOnIncomplete="false"
        stopOnSkipped="false">

    <filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">../modules</directory>
            <directory suffix=".php">../models</directory>
            <directory suffix=".php">../lib</directory>
            <directory suffix=".php">../components</directory>
            <exclude>
                <directory suffix=".php">../modules/*/views</directory>
                <directory suffix=".php">../modules/*/widgets</directory>
                <directory suffix=".php">../modules/*/controllers</directory>
                <directory suffix=".php">../modules/ClaimProfile</directory>
                <directory suffix=".php">../modules/SocialNetworks</directory>
            </exclude>
        </whitelist>
    </filter>

    <logging>
        <log type="coverage-clover" target="build/logs/clover.xml" />
        <log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="true" />
    </logging>
</phpunit>

和生成的clover.xml 确实包含有关命名空间类的信息,除Jenkin的PHP-Clover插件外,所有内容都保留报告范围,而忽略了命名空间中的代码. (即,报告中未显示任何定义名称空间的源文件,但列表中完全显示了代码完全落在全局名称空间中的文件).

and the resulting clover.xml does include information for namespaced classes and all but Jenkin's PHP-Clover plug-in keeps reporting coverage that disregards code that is inside a namespace. (i.e. none of source files that define namespaces are shown in the report but files with code that falls totally in the global namespace appear in the list).

推荐答案

最终遇到了同样的问题.原来Jenkins Clover PHP插件在这里包含错误:

Eventually ran into the same problem.Turned out that Jenkins Clover PHP Plugin contains an error here:

https://github.com/jenkinsci/cloverphp-plugin/blob/master/src/main/java/org/jenkinsci/plugins/cloverphp/CloverCoverageParser.java

很容易看出,Clover Coverage Parser分析了coverage/项目,coverage/项目/文件以及coverage/项目/文件/类对象.它会忽略coverage/project/package(以及内部的所有内容).

As one can easily see, Clover Coverage Parser parses coverage/project, coverage/project/file and coverage/project/file/class objects. It ignores coverage/project/package (and everything inside ).

可以通过插件维护者轻松修复.

This can be easily fixed by plugin maintainer.

这篇关于命名空间代码未包含在覆盖范围内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 00:58