Closed deoomen closed 2 years ago
I cannot reproduce the issue you describe:
$ ./vendor/bin/phpunit --coverage-text
PHPUnit 9.5.14 by Sebastian Bergmann and contributors.
Runtime: PHP 8.1.3 with PCOV 1.0.11
Configuration: /usr/local/src/php-code-coverage/phpunit.xml
.........SSSSSSSSSSSSSSSSSSSSSSSSSSSSS......................... 63 / 132 ( 47%)
............................................................... 126 / 132 ( 95%)
...... 132 / 132 (100%)
Time: 00:00.355, Memory: 38.00 MB
There were 29 skipped tests:
1) SebastianBergmann\CodeCoverage\Driver\PhpdbgDriverTest::testDoesNotSupportBranchAndPathCoverage
This test requires the PHPDBG commandline interpreter
/usr/local/src/php-code-coverage/tests/tests/Driver/PhpdbgDriverTest.php:22
2) SebastianBergmann\CodeCoverage\Driver\PhpdbgDriverTest::testBranchAndPathCoverageCanBeDisabled
This test requires the PHPDBG commandline interpreter
/usr/local/src/php-code-coverage/tests/tests/Driver/PhpdbgDriverTest.php:22
3) SebastianBergmann\CodeCoverage\Driver\PhpdbgDriverTest::testBranchAndPathCoverageCannotBeEnabled
This test requires the PHPDBG commandline interpreter
/usr/local/src/php-code-coverage/tests/tests/Driver/PhpdbgDriverTest.php:22
4) SebastianBergmann\CodeCoverage\Driver\PhpdbgDriverTest::testBranchAndPathCoverageIsNotCollected
This test requires the PHPDBG commandline interpreter
/usr/local/src/php-code-coverage/tests/tests/Driver/PhpdbgDriverTest.php:22
5) SebastianBergmann\CodeCoverage\Driver\PhpdbgDriverTest::testDoesNotSupportDeadCodeDetection
This test requires the PHPDBG commandline interpreter
/usr/local/src/php-code-coverage/tests/tests/Driver/PhpdbgDriverTest.php:22
6) SebastianBergmann\CodeCoverage\Driver\PhpdbgDriverTest::testDeadCodeDetectionCanBeDisabled
This test requires the PHPDBG commandline interpreter
/usr/local/src/php-code-coverage/tests/tests/Driver/PhpdbgDriverTest.php:22
7) SebastianBergmann\CodeCoverage\Driver\PhpdbgDriverTest::testDeadCodeDetectionCannotBeEnabled
This test requires the PHPDBG commandline interpreter
/usr/local/src/php-code-coverage/tests/tests/Driver/PhpdbgDriverTest.php:22
8) SebastianBergmann\CodeCoverage\Driver\PhpdbgDriverTest::testDeadCodeIsNotDetected
This test requires the PHPDBG commandline interpreter
/usr/local/src/php-code-coverage/tests/tests/Driver/PhpdbgDriverTest.php:22
9) SebastianBergmann\CodeCoverage\Driver\PhpdbgDriverTest::testHasNameAndVersion
This test requires the PHPDBG commandline interpreter
/usr/local/src/php-code-coverage/tests/tests/Driver/PhpdbgDriverTest.php:22
10) SebastianBergmann\CodeCoverage\Driver\Xdebug2DriverTest::testSupportsBranchAndPathCoverage
This test requires the Xdebug extension to be loaded
/usr/local/src/php-code-coverage/tests/tests/Driver/Xdebug2DriverTest.php:31
11) SebastianBergmann\CodeCoverage\Driver\Xdebug2DriverTest::testBranchAndPathCoverageCanBeDisabled
This test requires the Xdebug extension to be loaded
/usr/local/src/php-code-coverage/tests/tests/Driver/Xdebug2DriverTest.php:31
12) SebastianBergmann\CodeCoverage\Driver\Xdebug2DriverTest::testBranchAndPathCoverageCanBeEnabled
This test requires the Xdebug extension to be loaded
/usr/local/src/php-code-coverage/tests/tests/Driver/Xdebug2DriverTest.php:31
13) SebastianBergmann\CodeCoverage\Driver\Xdebug2DriverTest::testBranchAndPathCoverageIsNotCollectedByDefault
This test requires the Xdebug extension to be loaded
/usr/local/src/php-code-coverage/tests/tests/Driver/Xdebug2DriverTest.php:31
14) SebastianBergmann\CodeCoverage\Driver\Xdebug2DriverTest::testSupportsDeadCodeDetection
This test requires the Xdebug extension to be loaded
/usr/local/src/php-code-coverage/tests/tests/Driver/Xdebug2DriverTest.php:31
15) SebastianBergmann\CodeCoverage\Driver\Xdebug2DriverTest::testDeadCodeDetectionCanBeDisabled
This test requires the Xdebug extension to be loaded
/usr/local/src/php-code-coverage/tests/tests/Driver/Xdebug2DriverTest.php:31
16) SebastianBergmann\CodeCoverage\Driver\Xdebug2DriverTest::testDeadCodeDetectionCanBeEnabled
This test requires the Xdebug extension to be loaded
/usr/local/src/php-code-coverage/tests/tests/Driver/Xdebug2DriverTest.php:31
17) SebastianBergmann\CodeCoverage\Driver\Xdebug2DriverTest::testDeadCodeIsNotDetectedByDefault
This test requires the Xdebug extension to be loaded
/usr/local/src/php-code-coverage/tests/tests/Driver/Xdebug2DriverTest.php:31
18) SebastianBergmann\CodeCoverage\Driver\Xdebug2DriverTest::testHasNameAndVersion
This test requires the Xdebug extension to be loaded
/usr/local/src/php-code-coverage/tests/tests/Driver/Xdebug2DriverTest.php:31
19) SebastianBergmann\CodeCoverage\Driver\Xdebug2DriverTest::testFilterWorks
This test requires the Xdebug extension to be loaded
/usr/local/src/php-code-coverage/tests/tests/Driver/Xdebug2DriverTest.php:31
20) SebastianBergmann\CodeCoverage\Driver\Xdebug3DriverTest::testSupportsBranchAndPathCoverage
This test requires the Xdebug extension to be loaded
/usr/local/src/php-code-coverage/tests/tests/Driver/Xdebug3DriverTest.php:31
21) SebastianBergmann\CodeCoverage\Driver\Xdebug3DriverTest::testBranchAndPathCoverageCanBeDisabled
This test requires the Xdebug extension to be loaded
/usr/local/src/php-code-coverage/tests/tests/Driver/Xdebug3DriverTest.php:31
22) SebastianBergmann\CodeCoverage\Driver\Xdebug3DriverTest::testBranchAndPathCoverageCanBeEnabled
This test requires the Xdebug extension to be loaded
/usr/local/src/php-code-coverage/tests/tests/Driver/Xdebug3DriverTest.php:31
23) SebastianBergmann\CodeCoverage\Driver\Xdebug3DriverTest::testBranchAndPathCoverageIsNotCollectedByDefault
This test requires the Xdebug extension to be loaded
/usr/local/src/php-code-coverage/tests/tests/Driver/Xdebug3DriverTest.php:31
24) SebastianBergmann\CodeCoverage\Driver\Xdebug3DriverTest::testSupportsDeadCodeDetection
This test requires the Xdebug extension to be loaded
/usr/local/src/php-code-coverage/tests/tests/Driver/Xdebug3DriverTest.php:31
25) SebastianBergmann\CodeCoverage\Driver\Xdebug3DriverTest::testDeadCodeDetectionCanBeDisabled
This test requires the Xdebug extension to be loaded
/usr/local/src/php-code-coverage/tests/tests/Driver/Xdebug3DriverTest.php:31
26) SebastianBergmann\CodeCoverage\Driver\Xdebug3DriverTest::testDeadCodeDetectionCanBeEnabled
This test requires the Xdebug extension to be loaded
/usr/local/src/php-code-coverage/tests/tests/Driver/Xdebug3DriverTest.php:31
27) SebastianBergmann\CodeCoverage\Driver\Xdebug3DriverTest::testDeadCodeIsNotDetectedByDefault
This test requires the Xdebug extension to be loaded
/usr/local/src/php-code-coverage/tests/tests/Driver/Xdebug3DriverTest.php:31
28) SebastianBergmann\CodeCoverage\Driver\Xdebug3DriverTest::testHasNameAndVersion
This test requires the Xdebug extension to be loaded
/usr/local/src/php-code-coverage/tests/tests/Driver/Xdebug3DriverTest.php:31
29) SebastianBergmann\CodeCoverage\Driver\Xdebug3DriverTest::testFilterWorks
This test requires the Xdebug extension to be loaded
/usr/local/src/php-code-coverage/tests/tests/Driver/Xdebug3DriverTest.php:31
OK, but incomplete, skipped, or risky tests!
Tests: 132, Assertions: 270, Skipped: 29.
Code Coverage Report:
2022-02-18 16:13:10
Summary:
Classes: 20.69% (12/58)
Methods: 66.31% (250/377)
Lines: 84.92% (2607/3070)
SebastianBergmann\CodeCoverage\BranchAndPathCoverageNotSupportedException
Methods: ( 0/ 0) Lines: ( 0/ 0)
SebastianBergmann\CodeCoverage\CodeCoverage
Methods: 24.39% (10/41) Lines: 50.54% ( 94/186)
SebastianBergmann\CodeCoverage\CrapIndex
Methods: 66.67% ( 2/ 3) Lines: 88.89% ( 8/ 9)
SebastianBergmann\CodeCoverage\DeadCodeDetectionNotSupportedException
Methods: ( 0/ 0) Lines: ( 0/ 0)
SebastianBergmann\CodeCoverage\Directory
Methods: 0.00% ( 0/ 1) Lines: 50.00% ( 2/ 4)
SebastianBergmann\CodeCoverage\DirectoryCouldNotBeCreatedException
Methods: ( 0/ 0) Lines: ( 0/ 0)
SebastianBergmann\CodeCoverage\Driver\Driver
Methods: 60.00% ( 6/10) Lines: 77.78% ( 14/ 18)
SebastianBergmann\CodeCoverage\Driver\PathExistsButIsNotDirectoryException
Methods: 0.00% ( 0/ 1) Lines: 0.00% ( 0/ 1)
SebastianBergmann\CodeCoverage\Driver\PcovDriver
Methods: 25.00% ( 1/ 4) Lines: 28.57% ( 4/ 14)
SebastianBergmann\CodeCoverage\Driver\PcovNotAvailableException
Methods: 0.00% ( 0/ 1) Lines: 0.00% ( 0/ 1)
SebastianBergmann\CodeCoverage\Driver\PhpdbgDriver
Methods: 0.00% ( 0/ 5) Lines: 0.00% ( 0/ 22)
SebastianBergmann\CodeCoverage\Driver\PhpdbgNotAvailableException
Methods: 0.00% ( 0/ 1) Lines: 0.00% ( 0/ 1)
SebastianBergmann\CodeCoverage\Driver\Selector
Methods: 0.00% ( 0/ 2) Lines: 0.00% ( 0/ 20)
SebastianBergmann\CodeCoverage\Driver\WriteOperationFailedException
Methods: 0.00% ( 0/ 1) Lines: 0.00% ( 0/ 1)
SebastianBergmann\CodeCoverage\Driver\WrongXdebugVersionException
Methods: ( 0/ 0) Lines: ( 0/ 0)
SebastianBergmann\CodeCoverage\Driver\Xdebug2Driver
Methods: 0.00% ( 0/ 6) Lines: 0.00% ( 0/ 31)
SebastianBergmann\CodeCoverage\Driver\Xdebug2NotEnabledException
Methods: 0.00% ( 0/ 1) Lines: 0.00% ( 0/ 1)
SebastianBergmann\CodeCoverage\Driver\Xdebug3Driver
Methods: 0.00% ( 0/ 6) Lines: 0.00% ( 0/ 29)
SebastianBergmann\CodeCoverage\Driver\Xdebug3NotEnabledException
Methods: 0.00% ( 0/ 1) Lines: 0.00% ( 0/ 1)
SebastianBergmann\CodeCoverage\Driver\XdebugNotAvailableException
Methods: 0.00% ( 0/ 1) Lines: 0.00% ( 0/ 1)
SebastianBergmann\CodeCoverage\Filter
Methods: 88.89% ( 8/ 9) Lines: 97.06% ( 33/ 34)
SebastianBergmann\CodeCoverage\InvalidArgumentException
Methods: ( 0/ 0) Lines: ( 0/ 0)
SebastianBergmann\CodeCoverage\NoCodeCoverageDriverAvailableException
Methods: 0.00% ( 0/ 1) Lines: 0.00% ( 0/ 1)
SebastianBergmann\CodeCoverage\NoCodeCoverageDriverWithPathCoverageSupportAvailableException
Methods: 0.00% ( 0/ 1) Lines: 0.00% ( 0/ 1)
SebastianBergmann\CodeCoverage\Node\AbstractNode
Methods: 85.00% (17/20) Lines: 87.93% ( 51/ 58)
SebastianBergmann\CodeCoverage\Node\Builder
Methods: 80.00% ( 4/ 5) Lines: 97.30% ( 72/ 74)
SebastianBergmann\CodeCoverage\Node\Directory
Methods: 92.00% (23/25) Lines: 92.31% (108/117)
SebastianBergmann\CodeCoverage\Node\File
Methods: 75.00% (21/28) Lines: 78.41% (207/264)
SebastianBergmann\CodeCoverage\Node\Iterator
Methods: 75.00% ( 6/ 8) Lines: 75.00% ( 6/ 8)
SebastianBergmann\CodeCoverage\ParserException
Methods: ( 0/ 0) Lines: ( 0/ 0)
SebastianBergmann\CodeCoverage\Percentage
Methods: 100.00% ( 5/ 5) Lines: 100.00% ( 12/ 12)
SebastianBergmann\CodeCoverage\ProcessedCodeCoverageData
Methods: 100.00% (12/12) Lines: 100.00% ( 82/ 82)
SebastianBergmann\CodeCoverage\RawCodeCoverageData
Methods: 85.71% (12/14) Lines: 97.01% ( 65/ 67)
SebastianBergmann\CodeCoverage\ReflectionException
Methods: ( 0/ 0) Lines: ( 0/ 0)
SebastianBergmann\CodeCoverage\ReportAlreadyFinalizedException
Methods: 0.00% ( 0/ 1) Lines: 0.00% ( 0/ 1)
SebastianBergmann\CodeCoverage\Report\Clover
Methods: 0.00% ( 0/ 1) Lines: 83.80% (119/142)
SebastianBergmann\CodeCoverage\Report\Cobertura
Methods: 0.00% ( 0/ 1) Lines: 97.09% (167/172)
SebastianBergmann\CodeCoverage\Report\Crap4j
Methods: 50.00% ( 2/ 4) Lines: 88.06% ( 59/ 67)
SebastianBergmann\CodeCoverage\Report\Html\Dashboard
Methods: 83.33% ( 5/ 6) Lines: 96.15% (100/104)
SebastianBergmann\CodeCoverage\Report\Html\Directory
Methods: 0.00% ( 0/ 2) Lines: 90.74% ( 49/ 54)
SebastianBergmann\CodeCoverage\Report\Html\Facade
Methods: 75.00% ( 3/ 4) Lines: 94.74% ( 54/ 57)
SebastianBergmann\CodeCoverage\Report\Html\File
Methods: 52.38% (11/21) Lines: 93.31% (460/493)
SebastianBergmann\CodeCoverage\Report\Html\Renderer
Methods: 90.00% ( 9/10) Lines: 99.28% (137/138)
SebastianBergmann\CodeCoverage\Report\PHP
Methods: 0.00% ( 0/ 1) Lines: 85.71% ( 6/ 7)
SebastianBergmann\CodeCoverage\Report\Text
Methods: 60.00% ( 3/ 5) Lines: 79.87% (119/149)
SebastianBergmann\CodeCoverage\Report\Xml\BuildInformation
Methods: 80.00% ( 4/ 5) Lines: 84.62% ( 22/ 26)
SebastianBergmann\CodeCoverage\Report\Xml\Coverage
Methods: 66.67% ( 2/ 3) Lines: 93.75% ( 15/ 16)
SebastianBergmann\CodeCoverage\Report\Xml\Directory
Methods: ( 0/ 0) Lines: ( 0/ 0)
SebastianBergmann\CodeCoverage\Report\Xml\Facade
Methods: 69.23% ( 9/13) Lines: 91.30% (105/115)
SebastianBergmann\CodeCoverage\Report\Xml\File
Methods: 100.00% ( 5/ 5) Lines: 100.00% ( 25/ 25)
SebastianBergmann\CodeCoverage\Report\Xml\Method
Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 11/ 11)
SebastianBergmann\CodeCoverage\Report\Xml\Node
Methods: 100.00% ( 7/ 7) Lines: 100.00% ( 25/ 25)
SebastianBergmann\CodeCoverage\Report\Xml\Project
Methods: 85.71% ( 6/ 7) Lines: 87.50% ( 28/ 32)
SebastianBergmann\CodeCoverage\Report\Xml\Report
Methods: 87.50% ( 7/ 8) Lines: 96.88% ( 31/ 32)
SebastianBergmann\CodeCoverage\Report\Xml\Source
Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 6/ 6)
SebastianBergmann\CodeCoverage\Report\Xml\Tests
Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 9/ 9)
SebastianBergmann\CodeCoverage\Report\Xml\Totals
Methods: 85.71% ( 6/ 7) Lines: 98.04% ( 50/ 51)
SebastianBergmann\CodeCoverage\Report\Xml\Unit
Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 22/ 22)
SebastianBergmann\CodeCoverage\StaticAnalysisCacheNotConfiguredException
Methods: ( 0/ 0) Lines: ( 0/ 0)
SebastianBergmann\CodeCoverage\StaticAnalysis\CacheWarmer
Methods: 0.00% ( 0/ 1) Lines: 0.00% ( 0/ 4)
SebastianBergmann\CodeCoverage\StaticAnalysis\CodeUnitFindingVisitor
Methods: 57.14% ( 8/14) Lines: 83.90% ( 99/118)
SebastianBergmann\CodeCoverage\StaticAnalysis\ExecutableLinesFindingVisitor
Methods: 100.00% ( 5/ 5) Lines: 100.00% ( 22/ 22)
SebastianBergmann\CodeCoverage\StaticAnalysis\IgnoredLinesFindingVisitor
Methods: 66.67% ( 2/ 3) Lines: 83.33% ( 20/ 24)
SebastianBergmann\CodeCoverage\StaticAnalysis\ParsingFileAnalyser
Methods: 100.00% ( 9/ 9) Lines: 100.00% ( 79/ 79)
SebastianBergmann\CodeCoverage\TestIdMissingException
Methods: 0.00% ( 0/ 1) Lines: 0.00% ( 0/ 1)
SebastianBergmann\CodeCoverage\UnintentionallyCoveredCodeException
Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 7/ 7)
SebastianBergmann\CodeCoverage\Version
Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 3/ 3)
SebastianBergmann\CodeCoverage\XmlException
Methods: ( 0/ 0) Lines: ( 0/ 0)
Thank you for your report.
Please provide a minimal, self-contained, reproducing test case that shows the problem you are reporting.
Without such a minimal, self-contained, reproducing test case I will not be able to investigate this issue.
I'll try later to attach some code that can reproduce this. But for now I think it's probably connected with php-code-coverage
version 9.2.11
. Seems to be little strange...
Same problem here, php 7.4.24 with PCOV 1.0.9. The problem appeared because of an automatic update with the symfony bridge. It worked when we downgraded php-code-coverage
to version 9.2.10
using SYMFONY_PHPUNIT_REQUIRE
.
Since deoomen also seems to use symfony, there might be some voodoo interaction there.
On principle, I do not debug issues when Symfony's PHPUnit bridge is involved. Please provide a minimal, self-contained, reproducing test case that shows the problem you are reporting and does not involve third-party code such as Symfony's PHPUnit bridge.
This seems to be related to the Symfony PHPUnit bridge. To fix you can add:
<server name="SYMFONY_PHPUNIT_REQUIRE" value="phpunit/php-code-coverage:9.2.10" />
into your phpunit.xml.dist
@nicolas-grekas Do you have an idea what might be going on here? Thanks!
Doesn't inspire me anything but I can have a look. Could anyone affected provide me with a simple repository I could clone locally to run and debug this?
Very same issue. Thank you @varrol for finding a workaround.
p.s. Hope that an official fix (whether it's on the phpunit side or the symfony side) will follow soon.
the same issue here. workaround from @varrol works fine.
maybe it is helpful for debugging, the issue appears for me when i skip the tests folder name (as already multiple folders are defined in phpunit.xml.dist) within the cmd call:
works without the workaround - but ignores the additional paths given in the xml: "... --colors=never --configuration phpunit.xml.dist tests"
results in the named issue (the workaround helps here): "... --colors=never --configuration phpunit.xml.dist "
My error message is a little bit more verbose:
Generating code coverage report in Cobertura XML format ... SebastianBergmann\CodeCoverage\Node\Builder::__construct(): Argument #1 ($coveredFileAnalyser) must be of type SebastianBergmann\CodeCoverage\StaticAnalysis\CoveredFileAnalyser, SebastianBergmann\CodeCoverage\StaticAnalysis\ParsingFileAnalyser given, called in /builds/emtec/itm/itm-backend/vendor/bin/.phpunit/phpunit-9.5-0/vendor/phpunit/php-code-coverage/src/CodeCoverage.php on line 131
That matches the changelog: https://github.com/sebastianbergmann/php-code-coverage/blob/master/ChangeLog.md#changed-3
Switching back to 9.2.10 works.
The string CoveredFileAnalyser
does not exist in that version of php-code-coverage's codebase.
Looks like this comes from https://github.com/symfony/symfony/issues/45542
Thank you, Nicolas. I will close this ticket then.
Summary
When running tests with
--coverage-text
option an exception is thrown:composer info | sort
:Current behavior
An exception is thrown when using code coverage mode.
How to reproduce
Run tests with
--coverage-text
option.Expected behavior
No exception :)