Skip to content

PHPUnit coverage shows "EMPTY" for all files #392

@knallcharge

Description

@knallcharge

I'm using phpdox to generate the documentation for a project and I'm trying to include the PHPUnit-coverage, but it shows "EMPTY" for all files, e.g. my entities:

grafik

In issue #147 you state that "EMPTY" means that the file is "Not executable (e.g. an in interface)", but this happens for all my files. Also in the generated coverage-xml, the status for all files is "PASSED", e.g. for my User-entity:

<test name="App\Tests\Entity\UserTest::testCreateUser" size="unknown" result="0" status="PASSED"/>
<test name="App\Tests\Entity\UserTest::testGetRolesAndRolesAsString" size="unknown" result="0" status="PASSED"/>
<test name="App\Tests\Entity\UserTest::testAddAndGetStage" size="unknown" result="0" status="PASSED"/>
<test name="App\Tests\Entity\UserTest::testRemoveStage" size="unknown" result="0" status="PASSED"/>
<test name="App\Tests\Entity\UserTest::testHasStage" size="unknown" result="0" status="PASSED"/>
<test name="App\Tests\Entity\UserTest::testGetDisplayName" size="unknown" result="0" status="PASSED"/>
<test name="App\Tests\Entity\UserTest::testSerialize" size="unknown" result="0" status="PASSED"/>
<test name="App\Tests\Entity\UserTest::testUnserialize" size="unknown" result="0" status="PASSED"/>
<test name="App\Tests\Entity\UserTest::testCreateNewUser" size="unknown" result="0" status="PASSED"/>

Also in the corresponding xml for the Entity (User.php.xml) coverage is marked as "100":

<method name="serialize" signature="serialize(): string" start="310" end="319" crap="1" executable="6" executed="6" coverage="100"/>

But somehow phpdox is not able to map the information for some reason.

Here's the part of my phpunit.xml that generates the output:

<log type="coverage-html" target="../build/artifacts/coverage" lowUpperBound="35" highLowerBound="70"/>
<log type="coverage-xml" target="../build/artifacts/coveragexml" lowUpperBound="35" highLowerBound="70"/>
<log type="coverage-clover" target="../build/artifacts/index.xml"/>

This is my phpdox.xml:

<?xml version="1.0" encoding="utf-8" ?>
<phpdox xmlns="http://xml.phpdox.net/config" silent="false">
    <bootstrap/>
    <project name="phpdox" source="${basedir}/../src" workdir="${basedir}/../build/phpdox/xml">
        <collector publiconly="false" backend="parser" encoding="auto">
            <include mask="*.php"/>
            <exclude mask="*Migrations/*"/>
            <exclude mask="*Kernel.php*"/>
            <inheritance resolve="false">
            </inheritance>
        </collector>
        <generator output="${basedir}/../build">
            <enrich base="${basedir}/../build">
                <source type="phploc">
                    <file name="logs/phploc.xml"/>
                </source>
                <source type="phpcs">
                    <file name="phpcs.xml"/>
                </source>
                <source type="pmd">
                    <file name="logs/pmd.xml"/>
                </source>
                <source type="phpunit">
                    <coverage path="artifacts/coveragexml"/>
                </source>
            </enrich>
            <build engine="html" enabled="true" output="api">
                <template dir="${phpDox.home}/templates/html"/>
                <file extension="html"/>
            </build>
        </generator>
    </project>
</phpdox>

And this the output of phpdox (from Jenkins) which shows no error:

13:10:52 phpdox:
13:10:52    [phpdox] phpDox 0.12.0 - Copyright (C) 2010 - 2020 by Arne Blankerts and Contributors
13:10:52    [phpdox] 
13:10:52    [phpdox] [20.02.2020 - 13:10:52] Using config file './phpdox.xml'
13:10:52    [phpdox] [20.02.2020 - 13:10:52] Registered collector backend 'parser'
13:10:52    [phpdox] [20.02.2020 - 13:10:52] Registered enricher 'build'
13:10:52    [phpdox] [20.02.2020 - 13:10:52] Registered enricher 'git'
13:10:52    [phpdox] [20.02.2020 - 13:10:52] Registered enricher 'checkstyle'
13:10:52    [phpdox] [20.02.2020 - 13:10:52] Registered enricher 'phpcs'
13:10:52    [phpdox] [20.02.2020 - 13:10:52] Registered enricher 'pmd'
13:10:52    [phpdox] [20.02.2020 - 13:10:52] Registered enricher 'phpunit'
13:10:52    [phpdox] [20.02.2020 - 13:10:52] Registered enricher 'phploc'
13:10:52    [phpdox] [20.02.2020 - 13:10:52] Registered output engine 'xml'
13:10:52    [phpdox] [20.02.2020 - 13:10:52] Registered output engine 'html'
13:10:52    [phpdox] [20.02.2020 - 13:10:52] Starting to process project 'phpdox'
13:10:52    [phpdox] [20.02.2020 - 13:10:52] Starting collector
13:10:52    [phpdox] [20.02.2020 - 13:10:52] Scanning directory '<PATH_REMOVED>/workspace/build/../src' for files to process
13:10:52    [phpdox] 
13:10:53    [phpdox] ..................................................	[50]
13:10:53    [phpdox] ................................................  	[98]
13:10:53    [phpdox] 
13:10:53    [phpdox] [20.02.2020 - 13:10:53] Saving results to directory '<PATH_REMOVED>/workspace/build/../build/phpdox/xml'
13:10:56    [phpdox] [20.02.2020 - 13:10:56] Collector process completed
13:10:56    [phpdox] 
13:10:56    [phpdox] [20.02.2020 - 13:10:56] Starting generator
13:10:56    [phpdox] [20.02.2020 - 13:10:56] Loading enrichers
13:10:56    [phpdox] [20.02.2020 - 13:10:56] Enricher PHPLoc xml initialized successfully
13:10:56    [phpdox] [20.02.2020 - 13:10:56] Enricher PHPCS XML initialized successfully
13:10:56    [phpdox] [20.02.2020 - 13:10:56] Enricher PHPMessDetector XML initialized successfully
13:10:56    [phpdox] [20.02.2020 - 13:10:56] Enricher PHPUnit Coverage XML initialized successfully
13:10:56    [phpdox] [20.02.2020 - 13:10:56] Enricher Build Information initialized successfully
13:10:56    [phpdox] [20.02.2020 - 13:10:56] Starting event loop.
13:10:56    [phpdox] 
13:10:56    [phpdox] ..................................................	[50]
[cut]
13:11:11    [phpdox] ..................................................	[1400]
13:11:12    [phpdox] ......................                            	[1422]
13:11:12    [phpdox] 
13:11:12    [phpdox] [20.02.2020 - 13:11:12] Generator process completed
13:11:12    [phpdox] [20.02.2020 - 13:11:12] Processing project 'phpdox' completed.
13:11:12    [phpdox] 
13:11:12    [phpdox] 
13:11:12    [phpdox] Time: 19.67 seconds, Memory: 14.00 MB

Using phpdox 0.12.0 and PHPUnit 8.5.2 running on Jenkins 2.220 on Windows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions