mikeerickson / phpunit-pretty-result-printer

PHPUnit Pretty Result Printer -- make your PHPUnit tests look pretty!
MIT License
1.2k stars 71 forks source link

Doesn't work with legacy versions of PHPUnit #171

Open nicole-ashley opened 3 years ago

nicole-ashley commented 3 years ago

The unguarded references to PHPUnit\Runner\Version in src/Printer.php mean that this doesn't work with any version of PHPUnit before the namespace refactor. Understandably this is a pretty old version and most people shouldn't be running it, but this as module appears to support it elsewhere this should be fixed by wrapping them in a class_exists check.

mikeerickson commented 3 years ago

Hey @nikrolls

What version of PHPUnit are you using? What version of PHP are you using?

We have gone to great lengths to maintain support as far back as possible, but at some point we need to make a decision just how far back we can realistically support

I would be happy to take a look at this, but no promises.

nicole-ashley commented 3 years ago

@mikeerickson In this case I'm using PHPUnit 5.7 (sorry about that - the framework I'm using will update soon but hasn't yet) on PHP 7.4.

There are other issues with PHPUnit 5.7 - even when I make the changes I've suggested it still doesn't work - but in this issue I'm focusing solely on the logistical issues in src/Printer.php. PHPUnit\Runner\Version was introduced in PHPUnit 6.0; before that it was called PHPUnit_Runner_Version. There was no forward compatibility class for it either. So to support PHPUnit 5, you would need to wrap all of the usages of PHPUnit\Runner\Version in a class_exists check, or somehow use the legacy PHPUnit_Runner_Version class when PHPUnit\Runner\Version doesn't exist.

mikeerickson commented 3 years ago

@nikrolls ya, I am aware of what needs to new done, just hard to support so many versions of PHPUnit as they have a tendency to make these radical changes between releases. This will likely be a one of change to address your specific problem.

I will make time this coming week as I have slowed down a bit for thanksgiving and taking a bit of time off from my day job to refuel. But, I will get it addressed for you.

nicole-ashley commented 3 years ago

No worries, no rush! If I get a chance I will raise some PRs, but I can't promise anything 😁 Just wanted to make sure it was recorded.

mikeerickson commented 3 years ago

If you have the time, feel free. Otherwise I will get it knocked within the next week.