krakjoe / pcov

PCOV - CodeCoverage compatible driver for PHP
Other
697 stars 29 forks source link

Request: Support PHPUnit 7 because... WordPress. #25

Closed dac514 closed 5 years ago

dac514 commented 5 years ago

WordPress doesn't support PHPUnit 8, yet:

Travis.CI started giving us out of memory errors.

Did I mention WordPress.

Help? 😢

rask commented 5 years ago

This is mostly PHPUnit and php-code-coverage related, not PCOV, as they decide what coverage driver to load. PCOV support appeared in PHPUnit 8 as the php-code-coverage dependency introduced PCOV driver support in that release (php-code-coverage 7.x I think?).

The sanest approach would be to pester WordPress core developers to upgrade to PHPUnit 8, but I do understand that it would probably take ages to happen.

michaelbutler commented 5 years ago

Not sure why it is not mentioned in this project's README.md (maybe it should?) but there is a workaround for this... krakjoe created pcov/clobber as a small composer package that can be used to live patch PHPUnit 7 code to support pcov.

As a build prestep you could install clobber, run it on your project's root workspace, then run your test suite with pcov, then finally unclobber as a post step, and remove clobber package.

rask commented 5 years ago

@michaelbutler did not know about this, need to check it out. Thanks!

krakjoe commented 5 years ago

clobber is not mentioned in the readme because I would prefer if people just do the upgrade, clobber is not an elegant tool, it's a get-the-job-done tool that's fine to use temporarily, but I don't intend to maintain it into the future and it can't be considered a legitimate method of deploying pcov.

I totally get that it's not possible to "just do the upgrade", which is why clobber exists in the first place, but that we don't live in an ideal world is not a good excuse for failing to aim for ideal :)