Automattic / wordbless

WorDBless allows you to use WordPress core functions in your PHPUnit tests without having to set up a database and the whole WordPress environment
Other
131 stars 6 forks source link

Add PHP 8 / PHPUnit 9.0 support #41

Closed anomiex closed 3 years ago

anomiex commented 3 years ago

PHPUnit doesn't support PHP 8 until version 9.0, so we need to be compatible with that while still maintaining compatibility with PHPUnit 5.7.

Fortunately the only thing WorDBLess\BaseTestCase does that's not compatible with both 5.7 and 9.0 is its use of setUp and tearDown, and we can work around that by using @before and @after instead of overriding those methods.

Also this adds some tests to verify that the @before and @after methods are still called even if a subclass overrides setUp/tearDown or supplies its own @before/@after.

szepeviktor commented 3 years ago

Please add "php": "^5.6.20 || ^7.0 || ^8.0",

szepeviktor commented 3 years ago

Also this to CI

run: "composer require --no-interaction --no-progress --no-suggest --prefer-lowest --dev 'phpunit/phpunit:^6.5 || ^7.5 || ^9.0'"

szepeviktor commented 3 years ago

phar-io/manifest should be added to that line

szepeviktor commented 3 years ago

Can't do lowest right now either, apparently

@anomiex Yes you can, just add that package to CI

leogermani commented 3 years ago

Thanks for that @anomiex .

I've set up this PR so we can make sure everything will work

https://github.com/Automattic/jetpack/pull/17952

anomiex commented 3 years ago

Can't do lowest right now either, apparently

@anomiex Yes you can, just add that package to CI

I'm going to update the dependencies in a separate PR (#42).

anomiex commented 3 years ago

I've set up this PR so we can make sure everything will work

Automattic/jetpack#17952

Looks like they do, except for the PHP 8 test which was failing already (and getting that passing is what prompted me to do this 😀).