Brain-WP / BrainMonkey

Mocking utility for PHP functions and WordPress plugin API
https://giuseppe-mazzapica.gitbook.io/brain-monkey/
MIT License
304 stars 29 forks source link

Composer: update PHPUnit version constraints #112

Closed jrfnl closed 3 years ago

jrfnl commented 3 years ago

Note: while BrainMonkey doesn't have a direct, non-dev dependency on PHPUnit, it will generally be used in combination with PHPUnit. So, while I could have updated the dev version constraints to only allow for the latest minors of various PHPUnit versions, it seemed more prudent to allow for a liberal range of versions to allow for discovering potential incompatibilities with PHPUnit versions.

Composer: update PHPUnit version constraints [1]

While PHPUnit as of version 8.5.12 allows for installation on PHP 8.0, it still contained a nasty bug which would error out the test run with a Fatal when PHPUnit 8.5.12 would be installed for PHP 8.1.

This bug was fixed in version 8.5.14.

This adjustment of the version constraints means that when composer install is run with --prefer-lowest on PHP 8.x, PHPUnit 8.5.14 will be installed instead of PHP 8.5.12, while still allowing for all other 8.x versions in all other circumstances.

Ref: https://github.com/sebastianbergmann/phpunit/blob/8.5/ChangeLog-8.5.md

Composer: update PHPUnit version constraints [2]

PHPUnit 5.x allows for installation on PHP 5.6 and 7.x, however until version 5.7.26, it used the each() function, which was deprecated in PHP 7.2, which means that test runs against PHPUnit < 5.7.26 in combination with PHP 7.2 and higher would error out.

This adjustment of the version constraints means that when composer install is run with --prefer-lowest on PHP 5.6/7.x, PHPUnit 5.7.26 will be installed instead of PHP 5.7.9, preventing this issue.

Ref: https://github.com/sebastianbergmann/phpunit/blob/5.7.27/ChangeLog-5.7.md

gmazzap commented 3 years ago

Amazing, thank you!