Skip to content

Fix travis build: load PHPCS native bootstrap if available and test against PHP 7.2 #1130

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

Merged

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Sep 8, 2017

The upstream PR to support PHPUnit 6.x has (finally) been merged and will be released in PHPCS 3.1.

Currently builds against PHPCS master are failing because of this as the final version of the PHPCS PHPUnit 6.x support PR includes a test bootstrap in PHPCS which is not being loaded as we use our own bootstrap.

Easily solved though, by loading the upstream bootstrap - if the file exists - from our own PHPCS 3 bootstrap file. That way our unit testing will be compatible with all supported PHPCS 3.x versions.

The beStrictAboutTestsThatDoNotTestAnything="false" addition to the phpunit.xml.dist file is needed to prevent PHPUnit from reporting there are no tests in our test files (as the tests are in the upstream test suite and our "tests" are basically only data providers).

The changes made in #873 should, for now, not be reverted as PHPCS < 3.1 is not compatible with PHPUnit 6.x and accounting for all the different situations with an if statement in the build script would get unnecessarily complicated. See the table below for more details.

Once PHPCS 2.x support is dropped and the minimum supported PHPCS version has gone up to 3.1, we should be able to revert the changes made in #873 without issues (except for HHVM).

Upstream references:

Additionally:

  • While looking at the travis builds to fix this I noticed that nightly has gone up to PHP 7.3.0-dev, so I've added PHP 7.2 to the build matrix.

Detail overview of Travis build info as of today (Sept 8 2017):

PHP Travis PHPUnit PHPCS 2.x PHPCS < 3.1 PHPCS master Notes
5.3 4.8.18
5.4 4.8.35
5.5 4.8.27
5.6 5.5.0
7.0 6.3.0 / 5.3.4 If PHPUnit 5.3.4 ✅ for the previous two, but no telling what the logic is about which PHPUnit version is loaded
7.1 6.3.0
7.2 6.3.0
nightly 6.3.0
HHVM 6.3.0 Hit and miss, sometimes it will work, sometimes it won't

… against PHP 7.2

The upstream PR to support PHPUnit 6.x has (finally) been merged and will be released in PHPCS 3.1.

Currently builds against PHPCS `master` are failing because of this as the final version of the PHPCS PHPUnit 6.x support PR includes a test bootstrap in PHPCS which is not being loaded as we use our own bootstrap.

Easily solved though, by loading the upstream bootstrap - if the file exists - from our own PHPCS 3 bootstrap file. That way our unit testing will be compatible with all supported PHPCS 3.x versions.

The `beStrictAboutTestsThatDoNotTestAnything="false"` addition to the `phpunit.xml.dist` file is needed to prevent PHPUnit from reporting there are no tests in our test files (as the tests are in the upstream test suite and our "tests" are basically only data providers).

The changes made in 873 should, for now, not be reverted as PHPCS < 3.1 is not compatible with PHPUnit 6.x and accounting for all the different situation with an `if` statement in the build script would get unnecessarily complicated. See the table below for more details.

Once PHPCS 2.x support is dropped and the minimum supported PHPCS version has gone up to 3.1, we should be able to revert the changes made in 873 without issues (except for HHVM).

Upstream references:
* squizlabs/PHP_CodeSniffer 1383
* squizlabs/PHP_CodeSniffer 1384

Additionally:
* While looking at the travis builds to fix this I noticed that `nightly` has gone up to PHP `7.3.0-dev`, so I've added PHP 7.2 to the build matrix.
@JDGrimes
Copy link
Contributor

JDGrimes commented Sep 8, 2017

If PHPUnit 5.3.4 ✅ for the previous two, but no telling what the logic is about which PHPUnit version is loaded

Installing a different PHPUnit version should be as simple as adding composer global require "phpunit/phpunit=5.3.4" to the install steps. If that is needed.

@jrfnl
Copy link
Member Author

jrfnl commented Sep 8, 2017

Installing a different PHPUnit version should be as simple as adding composer global require "phpunit/phpunit=5.3.4" to the install steps. If that is needed.

That's what we are basically doing for all PHP 7 versions + HHVM now by downloading the PHPUnit phar. (= what was added in PR #873 )
We can't unconditionally require it via Composer as different PHP versions need different PHPUnit versions.

@GaryJones GaryJones merged commit 48cb87b into develop Sep 8, 2017
@GaryJones GaryJones deleted the feature/fix-travis-run-phpcs-3.1-phpunit-6.x-support branch September 8, 2017 22:10
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

Successfully merging this pull request may close these issues.

3 participants