Skip to content

Code Coverage data serialized from PHPUnit PHAR cannot be processed by PHPCOV #109

Open
@mstilkerich

Description

@mstilkerich
Q A
PHPUnit version 9.5.0
PHP version 7.4.3
Installation Method PHAR

Summary

When using PHPUnit phar archive (installed via phive), the generated php coverage report cannot be processed by phpcov 8.2.0 (also PHAR installed via phive). When using the same PHPUnit version installed via composer, phpcov processes the report.

Current behavior

  • Execute PHP unit tests; have PHP unit create coverage in PHP format
  • Execute phpcov to convert the .cov file produced by PHPUnit to clover

Result:

$ tools/phpunit -c tests/phpunit.xml
PHPUnit 9.5.0 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.3 with Xdebug 2.9.2
Configuration: tests/phpunit.xml

.                                                                   1 / 1 (100%)

Time: 00:01.324, Memory: 584.00 MB

OK (1 test, 1 assertion)

Generating code coverage report in PHP format ... done [00:00]
$ tools/phpcov merge --clover testreports/unit/clover.xml testreports/unit
phpcov 8.2.0 by Sebastian Bergmann.

Failed to merge: testreports/unit/coverage.cov

When doing the same using a PHPunit installed via composer, everything works just fine:

$ vendor/bin/phpunit -c tests/phpunit.xml
PHPUnit 9.5.0 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.3 with Xdebug 2.9.2
Configuration: tests/phpunit.xml

.                                                                   1 / 1 (100%)

Time: 00:00.629, Memory: 310.00 MB

OK (1 test, 1 assertion)

Generating code coverage report in PHP format ... done [00:00]
$ tools/phpcov merge --clover testreports/unit/clover.xml testreports/unit
phpcov 8.2.0 by Sebastian Bergmann.

Generating code coverage report in Clover XML format ... done

How to reproduce

Use the minimal example attached. The testreport directory also contains the output files that both the PHAR version as well as the composer version produced.

Expected behavior

PHAR version should work the same as the version from composer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions