theseer / phpdox

Documentation generator for PHP Code using standard technology (SRC, DOCBLOCK, XML and XSLT)
http://phpdox.de
Other
600 stars 121 forks source link

Coverage does not contain correct values #361

Closed tina-junold closed 5 years ago

tina-junold commented 5 years ago

Hi,

I'm currently facing the problem that the coverage box does not contain the correct values. Instead of 100% coverage, the coverage is shown as 0%.

image

image

I did some debugging and the problem seems not to be the index:

<?xml version="1.0" encoding="UTF-8"?>
<index xmlns="http://xml.phpdox.net/src" basedir="/path/to/example/src">
    <namespace name="App\Controller">
        <class name="DefaultController" src="Controller/DefaultController.php"
               xml="classes/App_Controller_DefaultController.xml">
            <enrichments>
                <enrichment type="phpunit">
                    <result xmlns="https://schema.phpunit.de/coverage/1.0" unknown="0" passed="2" skipped="0"
                            incomplete="0" failure="0" error="0" risky="0" warning="0"/>
                    <coverage xmlns="https://schema.phpunit.de/coverage/1.0" executable="1" executed="1" coverage="100"
                              crap="1"/>
                </enrichment>
            </enrichments>
        </class>
    </namespace>
    <namespace name="App\Helper">
        <class name="Greeter" src="Helper/Greeter.php" xml="classes/App_Helper_Greeter.xml">
            <enrichments>
                <enrichment type="phpunit">
                    <result xmlns="https://schema.phpunit.de/coverage/1.0" unknown="0" passed="1" skipped="0"
                            incomplete="0" failure="0" error="0" risky="0" warning="0"/>
                    <coverage xmlns="https://schema.phpunit.de/coverage/1.0" executable="1" executed="1" coverage="100"
                              crap="1"/>
                </enrichment>
            </enrichments>
        </class>
    </namespace>
    <enrichments>
        <enrichment type="build">
            <date unix="1557180159" date="06-05-2019" time="22:02:39" iso="2019-05-06T22:02:39+00:00"
                  rfc="Mon, 06 May 2019 22:02:39 +0000"/>
            <phpdox xmlns="http://xml.phpdox.net/src" version="0.12.0-dev"
                    info="phpDox 0.12.0-dev - Copyright (C) 2010 - 2019 by Arne Blankerts and Contributors"
                    generated="Generated using phpDox 0.12.0-dev - Copyright (C) 2010 - 2019 by Arne Blankerts and Contributors"
                    phar="no">
                <enricher type="build"/>
                <enricher type="phploc"/>
                <enricher type="git"/>
                <enricher type="phpcs"/>
                <enricher type="checkstyle"/>
                <enricher type="phpunit"/>
            </phpdox>
            <php xmlns="http://xml.phpdox.net/src" version="7.3.5" os="Linux">
                <zendextension name="Xdebug"/>
                <extension name="Core"/>
                <extension name="date"/>
                <extension name="libxml"/>
                <extension name="openssl"/>
                <extension name="pcre"/>
                <extension name="zlib"/>
                <extension name="ctype"/>
                <extension name="dom"/>
                <extension name="fileinfo"/>
                <extension name="filter"/>
                <extension name="hash"/>
                <extension name="json"/>
                <extension name="mbstring"/>
                <extension name="pcntl"/>
                <extension name="SPL"/>
                <extension name="PDO"/>
                <extension name="session"/>
                <extension name="posix"/>
                <extension name="readline"/>
                <extension name="Reflection"/>
                <extension name="standard"/>
                <extension name="SimpleXML"/>
                <extension name="Phar"/>
                <extension name="tokenizer"/>
                <extension name="xml"/>
                <extension name="xmlreader"/>
                <extension name="xmlwriter"/>
                <extension name="mysqlnd"/>
                <extension name="curl"/>
                <extension name="zip"/>
                <extension name="iconv"/>
                <extension name="bcmath"/>
                <extension name="xsl"/>
                <extension name="xdebug"/>
            </php>
        </enrichment>
        <enrichment type="phploc">
            <directories>3</directories>
            <files>4</files>
            <loc>130</loc>
            <lloc>42</lloc>
            <llocClasses>3</llocClasses>
            <llocFunctions>21</llocFunctions>
            <llocGlobal>18</llocGlobal>
            <cloc>20</cloc>
            <ccn>0</ccn>
            <ccnMethods>0</ccnMethods>
            <interfaces>0</interfaces>
            <traits>0</traits>
            <classes>2</classes>
            <abstractClasses>0</abstractClasses>
            <concreteClasses>2</concreteClasses>
            <functions>0</functions>
            <namedFunctions>0</namedFunctions>
            <anonymousFunctions>0</anonymousFunctions>
            <methods>3</methods>
            <publicMethods>3</publicMethods>
            <nonPublicMethods>0</nonPublicMethods>
            <nonStaticMethods>3</nonStaticMethods>
            <staticMethods>0</staticMethods>
            <constants>0</constants>
            <classConstants>0</classConstants>
            <globalConstants>0</globalConstants>
            <testClasses>2</testClasses>
            <testMethods>3</testMethods>
            <ccnByLloc>0</ccnByLloc>
            <llocByNof>0</llocByNof>
            <methodCalls>24</methodCalls>
            <staticMethodCalls>0</staticMethodCalls>
            <instanceMethodCalls>24</instanceMethodCalls>
            <attributeAccesses>1</attributeAccesses>
            <staticAttributeAccesses>0</staticAttributeAccesses>
            <instanceAttributeAccesses>1</instanceAttributeAccesses>
            <globalAccesses>0</globalAccesses>
            <globalVariableAccesses>0</globalVariableAccesses>
            <superGlobalVariableAccesses>0</superGlobalVariableAccesses>
            <globalConstantAccesses>0</globalConstantAccesses>
            <classCcnMin>1</classCcnMin>
            <classCcnAvg>1</classCcnAvg>
            <classCcnMax>1</classCcnMax>
            <classLlocMin>0</classLlocMin>
            <classLlocAvg>0.75</classLlocAvg>
            <classLlocMax>2</classLlocMax>
            <methodCcnMin>1</methodCcnMin>
            <methodCcnAvg>1</methodCcnAvg>
            <methodCcnMax>1</methodCcnMax>
            <methodLlocMin>1</methodLlocMin>
            <methodLlocAvg>1</methodLlocAvg>
            <methodLlocMax>1</methodLlocMax>
            <namespaces>4</namespaces>
            <ncloc>110</ncloc>
        </enrichment>
        <enrichment type="git">
            <tags xmlns="http://xml.phpdox.net/gitlog">
                <tag name="0.1.0"/>
                <tag name="0.2.0"/>
                <tag name="0.2.1"/>
                <tag name="0.2.10"/>
                <tag name="0.2.11"/>
                <tag name="0.2.11-RC.1"/>
                <tag name="0.2.11-RC.2"/>
                <tag name="0.2.12"/>
                <tag name="0.2.2"/>
                <tag name="0.2.3"/>
                <tag name="0.2.4"/>
                <tag name="0.2.5"/>
                <tag name="0.2.6"/>
                <tag name="0.2.7"/>
                <tag name="0.2.7-RC.1"/>
                <tag name="0.2.8"/>
                <tag name="0.2.9"/>
                <tag name="0.3.0"/>
                <tag name="0.4.0"/>
                <tag name="0.4.0-RC.1"/>
                <tag name="0.4.0-RC.2"/>
                <tag name="0.4.0-RC.3"/>
                <tag name="0.4.0-RC.4"/>
                <tag name="0.4.1"/>
                <tag name="0.4.2"/>
                <tag name="0.4.3"/>
                <tag name="0.4.4"/>
                <tag name="0.4.4-RC.1"/>
                <tag name="0.4.5"/>
                <tag name="0.4.5-RC.1"/>
                <tag name="0.4.5-RC.2"/>
                <tag name="0.4.6"/>
                <tag name="0.4.6-RC.1"/>
                <tag name="0.4.6-RC.2"/>
                <tag name="0.4.7"/>
                <tag name="0.4.7-rc.1"/>
                <tag name="0.4.7-rc.2"/>
                <tag name="0.4.7-rc.3"/>
                <tag name="0.4.7-rc.4"/>
                <tag name="0.4.7-rc.5"/>
                <tag name="0.4.7-rc.6"/>
                <tag name="0.4.7-rc.7"/>
                <tag name="0.5.0"/>
                <tag name="0.5.0-beta.1"/>
                <tag name="0.5.0-beta.2"/>
                <tag name="0.5.0-beta.3"/>
                <tag name="0.5.0-beta.4"/>
                <tag name="0.5.1"/>
            </tags>
            <branches xmlns="http://xml.phpdox.net/gitlog">
                <branch name="develop"/>
                <branch name="feature/phpdox"/>
                <branch name="master"/>
            </branches>
            <current xmlns="http://xml.phpdox.net/gitlog" describe="0.2.7-66-g0840b09-dirty"
                     branch="feature/phpdox" commit="0840b091028c9ddf4c05abd41cb565c75f7cc854"/>
        </enrichment>
    </enrichments>
</index>
theseer commented 5 years ago

That seems to be a bug in the template not finding the phpunit coverage nodes because it's using an outdated XMLNS for the PHPUnit Coverage XML.

If you want to help fixing that, it would be nice if you could verify this for me quickly. Given that you do not use the phar version, you should have easy access to the templates/html folder and the file class.xsl. Change line 5 reading xmlns:pu="http://schema.phpunit.de/coverage/1.0" to xmlns:pu="https://schema.phpunit.de/coverage/1.0", e.g. add the s to http.

And let me know whether that fixes it.

tina-junold commented 5 years ago

Jep, that one fixes it...

image

theseer commented 5 years ago

Thanks!

Fixed with bc5222aadecd69a9ad79a83c08673261551a39e6.