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

Backward compatibility with old PHPUnit versions #3543

Closed
filips123 opened this issue Feb 22, 2019 · 8 comments
Closed

Backward compatibility with old PHPUnit versions #3543

filips123 opened this issue Feb 22, 2019 · 8 comments

Comments

@filips123
Copy link

My project's dependencies require PHP 5.5 or later, so I want to test my project on PHP 5.5 - 7.3 with PHPUnit.

Until PHPUnit 8, I was able to test it with just requiring PHPUnit 4.8+ which had forward compatibility for namespaced test case syntax as described in my StackOverflow question.

But PHPUnit 8 now has return type declaration which is not compatible with older PHP and PHPUnit versions.

Is there any backward compatibility or another possibility to use the same test case for all PHPUnit (PHP) version?

@sebastianbergmann
Copy link
Owner

This is not a discussion or support forum, sorry. Everything I have to say on this subject I have written down here.

@filips123
Copy link
Author

@sebastianbergmann So the only possible solution is to not use PHPUnit 8? Or is there some "polyfill" for this?

@keradus
Copy link
Contributor

keradus commented Feb 25, 2019

@filips123 a little polyfills we created at PHP CS Fixer to have more wide range of PHPUnit versions available for us, yet having the code written in "new" way already (so polyfills of most crucial upcoming changes, nothing about backward compatibility) is available here:
https://github.com/PHPUnitGoodPractices/polyfill
keep in mind it's not PHPUnit 8 ready, but nothing prevents sending a PR for it ;)

@filips123
Copy link
Author

When it will be ready for PHPUnit 8? Unfortunately I currently don't have time to add support for it.

Also, I recommend that you add some exampley, documentation and README file to it. So it will be easier to use it.

@epdenouden
Copy link
Contributor

@keradus

keep in mind it's not PHPUnit 8 ready, but nothing prevents sending a PR for it ;)

Did you just invite us to your party? 🎈 🍰

@keradus
Copy link
Contributor

keradus commented Feb 25, 2019

When it will be ready for PHPUnit 8? Unfortunately I currently don't have time to add support for it.

whenever someone would find time for it. it's not on my prio list, yet's it's open and public - if your needs for it are bigger than mine, just give it a try ;)

Also, I recommend that you add some exampley, documentation and README file to it. So it will be easier to use it.

sure. as I said on beginning, we have it done for our PHP CS Fixer mostly, that's why it's not greatly documented etc. yet, at same time, it allows us to use "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1" and write code as it would always be ^7


@epdenouden , depends on the need. I do understand that this package is aimed only for projects that are using legacy (or at least not newest) version of the tool, but well, syntax linter has to support more than newest PHP engine ;)

@filips123
Copy link
Author

@keradus I opened issues about PHPUnit 8 and documentation at PHPUnitGoodPractices/polyfill#6 and PHPUnitGoodPractices/polyfill#7.

@sanmai
Copy link
Contributor

sanmai commented Nov 16, 2020

For anyone's solving this problem of testing under PHP 5.5 - PHP 8.0 with PHPUnit, here's how it can be done: php-coveralls/php-coveralls#295

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

5 participants