Travis: test builds against PHP 7.4 & improve PHPUnit 8 fix#2416
Merged
gsherwood merged 1 commit intosquizlabs:masterfrom Feb 26, 2019
Merged
Travis: test builds against PHP 7.4 & improve PHPUnit 8 fix#2416gsherwood merged 1 commit intosquizlabs:masterfrom
gsherwood merged 1 commit intosquizlabs:masterfrom
Conversation
This was referenced Feb 11, 2019
Merged
Nightly has become PHP 8.0 since PHP 7.4 has been branched, so to continue to also test against PHP 7.4, it needs to be added separately. As PHPStan can't currently be run (yet) on PHP 8, the environment variable for it has also been moved to PHP 7.4. Refs: * https://twitter.com/nikita_ppv/status/1089839541828112384 * https://twitter.com/nikita_ppv/status/1094897743594770433 PHPUnit 8 adds `void` return type declarations to the PHPUnit methods used by PHPCS, making it neigh impossible to make the unit test suite cross-version compatible for the PHP versions supported by PHPCS. Officially, PHPUnit 7 is compatible with PHP 7.1, 7.2 and 7.3. However for the functionality used by the PHPCS test suite, it looks to be compatible with PHP 7.4 as well (for now). Ref: https://phpunit.de/supported-versions.html For this reason, for Travis images which come natively with PHPUnit 8 (PHP >= 7.2), PHPUnit 7 needs to be installed via Composer. This is not necessary for older PHP versions and skipping the `composer install` when it's not needed, will make the build a little faster. Note: Doing the `composer install` in the `before_install` step will show a build as "errored" instead of "failed" if something would go wong with this install, which is more representative of the real build status. As for `nightly`/PHP 8: * The Travis native PHPUnit version for `nightly` is PHPUnit 8, which will not work. * Running `composer install` for PHPUnit on `nightly` currently installs PHPUnit 4.1.6. Most likely because the PHPUnit 4.x `composer.json` file did not yet contain a PHP requirement, while any higher PHPUnit versions do. Anyways, that will most definitely not work. * Running `composer install` for PHPUnit with a requirement of PHPUnit 7.x will also not work as PHPUnit 7 will not install on PHP 8 based on the PHPUnit `composer.json` file. All in all, the unit tests can not currently be run on PHP 8. When the PHPUnit build step would be active on `nightly` it would automatically fail the build. This would mask any errors in other build steps. So, for now, I've elected to skip running the unit tests on PHP 8 (`nightly`). This will allow all the other build tests which *can* be run on PHP 8 to still be tested and report appropriate statuses.
a160659 to
76999f6
Compare
Member
|
Thanks a lot for this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test builds against PHP 7.4
Nightly has become PHP 8.0 since PHP 7.4 has been branched, so to continue to also test against PHP 7.4, it needs to be added separately.
As PHPStan can't currently be run (yet) on PHP 8, the environment variable for it has also been moved to PHP 7.4.
Refs:
Improve PHPUnit 8 fix
PHPUnit 8 adds
voidreturn type declarations to the PHPUnit methods used by PHPCS, making it neigh impossible to make the unit test suite cross-version compatible for the PHP versions supported by PHPCS.Officially, PHPUnit 7 is compatible with PHP 7.1, 7.2 and 7.3. However for the functionality used by the PHPCS test suite, it looks to be compatible with PHP 7.4 as well (for now).
Ref: https://phpunit.de/supported-versions.html
For this reason, for Travis images which come natively with PHPUnit 8 (PHP >= 7.2), PHPUnit 7 needs to be installed via Composer.
This is not necessary for older PHP versions and skipping the
composer installwhen it's not needed, will make the build a little faster.Note: Doing the
composer installin thebefore_installstep will show a build as "errored" instead of "failed" if something would go wong with this install, which is more representative of the real build status.As for
nightly/PHP 8:nightlyis PHPUnit 8, which will not work.composer installfor PHPUnit onnightlycurrently installs PHPUnit 4.1.6. Most likely because the PHPUnit 4.xcomposer.jsonfile did not yet contain a PHP requirement, while any higher PHPUnit versions do. Anyways, that will most definitely not work.composer installfor PHPUnit with an explicit requirement of PHPUnit 7.x will also not work as PHPUnit 7 will not install on PHP 8 based on the PHPUnitcomposer.jsonfile.All in all, the unit tests can not currently be run on PHP 8.
When the PHPUnit build step would be active on
nightlyit would automatically fail the build. This would mask any errors in other build steps.So, for now, I've elected to skip running the unit tests on PHP 8 (
nightly). This will allow all the other build tests which can be run on PHP 8 to still be tested and report appropriate statuses.