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

Run tests against PHP 8 #436

Merged
merged 7 commits into from
Nov 30, 2020
Merged

Run tests against PHP 8 #436

merged 7 commits into from
Nov 30, 2020

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Nov 18, 2020

Slightly simpler alternative for #428 to allow the tests to run on PHP 8 for now (save for two tests).

Based on this set up, we can conclude that for the code covered by the current tests, the library is compatible with PHP 8.

Closes #428

/cc @TimothyBJacobs

Commit details

Travis: simplify setting of COMPOSER_PHPUNIT env variable

Composer: add convenience scripts for running the tests

Tests: fix PHPUnit configuration

The PHPUnit configuration did not validate against any available PHPUnit XSD file.

This stabilizes the file and annotates against which XSD it has been validated.

Notes:

  • The default value of the backupGlobals option has changed in PHPUnit 6 from true to false.
    Setting this explicitly to true for cross-version compatibility.
  • The file will now validate against the PHPUnit XSD for PHPUnit 4.4 up to 9.2.

Composer: allow installation of a wider range of PHPUnit versions

Travis: allow installing PHPUnit 7.5 on nightly

RequestsTest_Transport_Base::testStatusCodeThrow*(): prevent marking as risky

These two tests set exception expectations in a limited set of circumstances. In all other circumstances they basically test that no exception is being thrown.

As in the "no exception" cases, no other assertions are performed, the tests would be marked as "risky".

By doing a simple assertTrue(), we prevent the test being marked as risky, while maintaining the existing test functionality.

Tests: selectively skip two tests on PHP 8

... as they would fail due to the PHPUnit version being used not being compatible with PHP 8.

Once the test suite has been made compatible with PHPUnit 9.x, these tests should be able to run fine on PHP 8.

The PHPUnit configuration did not validate against any available PHPUnit XSD file.

This stabilizes the file and annotates against which XSD it has been validated.

Notes:
* The default value of the `backupGlobals` option has changed in PHPUnit 6 from `true` to `false`.
    Setting this explicitly to `true` for cross-version compatibility.
* The file will now validate against the PHPUnit XSD for PHPUnit 4.4 up to 9.2.
…as risky

These two tests set exception expectations in a limited set of circumstances. In all other circumstances they basically test that *no* exception is being thrown.

As in the "no exception" cases, no other assertions are performed, the tests would be marked as "risky".

By doing a simple `assertTrue()`, we prevent the test being marked as risky, while maintaining the existing test functionality.
... as they would fail due to the PHPUnit version being used not being compatible with PHP 8.

Once the test suite has been made compatible with PHPUnit 9.x, these tests should be able to run fine on PHP 8.
@schlessera schlessera merged commit 282d774 into master Nov 30, 2020
@schlessera schlessera deleted the feature/run-tests-against-php8 branch November 30, 2020 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants