Skip to content

Commit

Permalink
Drop support for PHPUnit < 6.4 [1]
Browse files Browse the repository at this point in the history
Adjust CI, README and `composer.json` for the drop of support for PHPUnit < 6.4.4.

The 6.4.4 version is a deliberate choice to allow for dropping:
* The `ExpectExceptionObject` polyfill (native method was introduced in PHPUnit 6.4.0 with bugfix in PHPUnit 6.4.4)
* A work-around in the `AssertStringContains` polyfills for a bug which was fixed in PHPUnit 6.4.2.
* And not requiring a call to `expectException()` for a call to `expectExceptionMessage()` (bug fixed in PHPUnit 6.4.3).
  • Loading branch information
jrfnl committed Jul 17, 2024
1 parent 8e48f77 commit 2543a55
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 23 deletions.
26 changes: 8 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,21 @@ jobs:
include:
# Test against a version on the low-end of the PHPUnit versions supported for each PHP version.
# Using the Composer `--prefer-lowest` option is, unfortunately, not viable, as
# it would result PHP 7.0 - 7.4 all using PHPUnit 5.7.21, which is not the intention.
# it would result PHP 7.0 - 7.4 all using PHPUnit 6.4.4, which is not the intention.
# It also would run into trouble with PHP 8.5.12 being used on PHP 8.0+, while the
# 8.5.12 release still contained a bug which makes it incompatible with PHP 8.1+,
# even though it officially allows for it..
- php: '7.0'
phpunit: '5.7.27'
phpunit: '6.4.4'
coverage: true
experimental: false
- php: '7.1'
phpunit: '5.7.21'
phpunit: '~6.4.4'
coverage: true
experimental: false
- php: '7.2'
phpunit: '6.3.1'
# - PHPUnit 7.0 seems to have an issue with something related to TestListeners, so using PHPUnit 7.1 instead for "low".
phpunit: '~7.1.0'
coverage: true
experimental: false
- php: '7.3'
Expand Down Expand Up @@ -199,24 +200,13 @@ jobs:
# and very select other combinations.
# This should be sufficient to record the coverage for the PHAR specific code.

# PHPUnit 5 is only supported for PHPUnit 5.7.21-latest.
# PHPUnit 6 is only supported for PHPUnit 6.4.4-latest on the officially supported PHP versions.
- php: '7.0'
phpunit: '5.7.21'
- php: '7.0'
phpunit: '5'
- php: '7.1'
phpunit: '5.7.21'
- php: '7.1'
phpunit: '5'
coverage: true

# PHPUnit 6 is fully supported for the officially supported PHP versions.
- php: '7.0'
phpunit: '6.0'
phpunit: '6.4'
- php: '7.0'
phpunit: '6'
- php: '7.2'
phpunit: '6.0'
phpunit: '6.4'
- php: '7.2'
phpunit: '6'
coverage: true
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Requirements
------------

* PHP 7.0 or higher.
* [PHPUnit] 5.7 - 10.x (automatically required via Composer).
* [PHPUnit] 6.4 - 10.x (automatically required via Composer).

[PHPUnit]: https://packagist.org/packages/phpunit/phpunit

Expand Down Expand Up @@ -65,7 +65,7 @@ Why use the PHPUnit Polyfills?

This library is set up to allow for creating PHPUnit cross-version compatible tests by offering a number of polyfills for functionality which was introduced, split up or renamed in PHPUnit.

### Write your tests for PHPUnit 10.x and run them on PHPUnit 5.7 - 10.x
### Write your tests for PHPUnit 10.x and run them on PHPUnit 6.4 - 10.x

The polyfills have been setup to allow tests to be _forward_-compatible. What that means is, that your tests can use the assertions supported by the _latest_ PHPUnit version, even when running on older PHPUnit versions.

Expand Down Expand Up @@ -163,11 +163,11 @@ You will need to make sure to `use` any additional traits needed for the polyfil

| PHPUnit | When `use`-ing this trait | You also need to `use` this trait |
| --------- | --------------------------- | --------------------------------- |
| 5.7 < 7.5 | `AssertIgnoringLineEndings` | `AssertStringContains` |
| 6.4 < 7.5 | `AssertIgnoringLineEndings` | `AssertStringContains` |

_**Note: this only applies to the stand-alone use of the traits. The [`TestCase` classes](#testcases) provided by this library already take care of this automatically.**_

Code example for a test using the `AssertIgnoringLineEndings` trait, which needs to be able to run on PHPUnit 5.7:
Code example for a test using the `AssertIgnoringLineEndings` trait, which needs to be able to run on PHPUnit 6.4:
```php
<?php

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"require": {
"php": ">=7.0",
"phpunit/phpunit": "^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0"
"phpunit/phpunit": "^6.4.4 || ^7.0 || ^8.0 || ^9.0 || ^10.0"
},
"require-dev": {
"php-parallel-lint/php-console-highlighter": "^1.0.0",
Expand Down

0 comments on commit 2543a55

Please sign in to comment.