Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run phpunit --coverage-text on PHPUnit itself - Undefined method CodeCoverage::createWithFilter() #4495

Closed
synchi opened this issue Oct 26, 2020 · 2 comments

Comments

@synchi
Copy link

synchi commented Oct 26, 2020

I am trying to find the line coverage of PHPUnit itself.

I am able to run phpunit on the project:

.../phpunit$ ./phpunit
PHPUnit 9.3-g709545de9 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.11 with Xdebug 2.9.8
Configuration: .../phpunit/phpunit.xml

.............................................................   61 / 2782 (  2%)

However, I am unable to run phpunit with --coverage-text:

 ./phpunit --coverage-text
PHPUnit 9.3-g709545de9 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.11 with Xdebug 2.9.8
Configuration: .../phpunit/phpunit.xml
PHP Fatal error:  Uncaught Error: Call to undefined method SebastianBergmann\CodeCoverage\CodeCoverage::createWithFilter() in .../phpunit/src/TextUI/TestRunner.php:527
Stack trace:
#0 .../phpunit/src/TextUI/Command.php(108): PHPUnit\TextUI\TestRunner->run()
#1 .../phpunit/src/TextUI/Command.php(68): PHPUnit\TextUI\Command->run()
#2 .../phpunit/phpunit(61): PHPUnit\TextUI\Command::main()
#3 {main}
  thrown in .../phpunit/src/TextUI/TestRunner.php on line 527

I've tried checking out and composer installing different commits.
Setup using PhpStorm fails as well, it cannot create a phar out of the phpunit file in the root as specified by the README in the tests dir.

I'm running this on Windows Subsystem for Linux, Ubuntu 20.04.1 LTS.
I'm not having this issue with other PHP projects on the same system.

Any tips appreciated!

@sebastianbergmann
Copy link
Owner

I cannot reproduce this:

$ ./phpunit --coverage-text
PHPUnit 9.4.2-31-g09750d983 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.11 with PCOV 1.0.6
Configuration: /usr/local/src/phpunit/phpunit.xml

.............................................................   61 / 2845 (  2%)
.
.
.
.......................................                       2845 / 2845 (100%)

Time: 00:42.633, Memory: 120.00 MB

There were 16 skipped tests:

.
.
.

OK, but incomplete, skipped, or risky tests!
Tests: 2845, Assertions: 4827, Skipped: 16.


Code Coverage Report:         
  2020-10-26 18:52:37         
                              
 Summary:                     
  Classes: 49.80% (125/251)   
  Methods: 76.59% (1469/1918) 
  Lines:   83.90% (8818/10510)

.
.
.

@synchi
Copy link
Author

synchi commented Oct 26, 2020

@sebastianbergmann Thanks for providing the coverage report so quickly. Still hoping to find a solution, but this definitely helps for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants