Skip to content

Commit 701f40c

Browse files
committed
Allow installation in combination with PHPUnit 4.8.36
To allow for testing on PHP 5.5, PHPUnit 4 is needed. PHPUnit 4.8.36 is the only version in the 4.x series which contains the forward-compatible layer with the namespaced versions of common PHPUnit classes. With the additional polyfills which have been put in place, installation of this package on PHP 5.5 in combination with PHPUnit 4.8.36 is now supported. Includes annotating this change in all the relevant places. Includes adding a new build to the Travis matrix to also run all tests against PHP 5.5 / PHPUnit 4.8.36.
1 parent 347c768 commit 701f40c

File tree

6 files changed

+16
-12
lines changed

6 files changed

+16
-12
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ jobs:
4242
# Check the code style of the code base.
4343
- composer check-cs
4444

45+
- stage: test
46+
php: 5.5
47+
dist: trusty
48+
4549
allow_failures:
4650
# Allow failures for unstable builds.
4751
- php: "nightly"

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit
2424
Requirements
2525
-------------------------------------------
2626

27-
* PHP 5.6 or higher.
28-
* PHPUnit 5.7 - 9.x (automatically required via Composer).
27+
* PHP 5.5 or higher.
28+
* PHPUnit 4.8 - 9.x (automatically required via Composer).
2929

3030

3131
Installation
@@ -53,7 +53,7 @@ This library is set up to allow for creating PHPUnit cross-version compatible te
5353

5454
This library offers a number of polyfills for functionality which was introduced, split up or renamed in PHPUnit.
5555

56-
### Write your tests for PHPUnit 9.x and run them on PHPUnit 5.7 - 9.x
56+
### Write your tests for PHPUnit 9.x and run them on PHPUnit 4.8 - 9.x
5757

5858
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.
5959

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"prefer-stable": true,
2525
"require": {
2626
"php": ">=5.5",
27-
"phpunit/phpunit": "^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0"
27+
"phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0"
2828
},
2929
"require-dev": {
3030
"php-parallel-lint/php-parallel-lint": "^1.2.0",

phpunitpolyfills-autoload.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,13 @@ public static function loadAssertEqualsSpecializations() {
241241
* if a PHPUnit version is used which already contains this functionality.
242242
*
243243
* Includes aliasing any PHPUnit native classes needed for this functionality
244-
* which aren't available under their namespaced name in PHPUnit 5.x.
244+
* which aren't available under their namespaced name in PHPUnit 4.x/5.x.
245245
*
246246
* @return void
247247
*/
248248
public static function loadExpectPHPException() {
249249
/*
250-
* Alias the PHPUnit 5 Error classes to their PHPUnit >= 6 name.
250+
* Alias the PHPUnit 4/5 Error classes to their PHPUnit >= 6 name.
251251
*
252252
* {@internal The `class_exists` wrappers are needed to play nice with
253253
* PHPUnit bootstrap files of test suites implementing this library
@@ -364,7 +364,7 @@ public static function loadTestCase() {
364364
public static function loadTestListenerDefaultImplementation() {
365365
if ( \class_exists( PHPUnit_Version::class ) === false ) {
366366
/*
367-
* Alias one particular PHPUnit 5 class to its PHPUnit >= 6 name.
367+
* Alias one particular PHPUnit 4/5 class to its PHPUnit >= 6 name.
368368
*
369369
* All other classes needed are part of the forward-compatibility layer.
370370
*

src/Polyfills/AssertIsType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public static function assertIsCallable( $actual, $message = '' ) {
142142
*
143143
* {@internal Support for `iterable` was only added to the `Assert::assertInternalType()` method
144144
* in PHPUnit 7.1.0, so this polyfill can't use that functionality until the minimum supported
145-
* PHPUnit version of this library would be PHPUnit 7.1.0. (Currently 5.7.0).
145+
* PHPUnit version of this library would be PHPUnit 7.1.0.}
146146
*
147147
* @link https://github.com/sebastianbergmann/phpunit/pull/3035 PR which added support for `is_iterable`
148148
* to `Assert::assertInternalType()`.
@@ -289,7 +289,7 @@ public static function assertIsNotCallable( $actual, $message = '' ) {
289289
*
290290
* {@internal Support for `iterable` was only added to the `Assert::assertNotInternalType()` method
291291
* in PHPUnit 7.1.0, so this polyfill can't use that functionality until the minimum supported
292-
* PHPUnit version of this library would be PHPUnit 7.1.0. (Currently 5.7.0).
292+
* PHPUnit version of this library would be PHPUnit 7.1.0.}
293293
*
294294
* @link https://github.com/sebastianbergmann/phpunit/pull/3035 PR which added support for `is_iterable`
295295
* to `Assert::assertNotInternalType()`.

src/TestListeners/TestListenerDefaultImplementationPHPUnitLte5.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use PHPUnit_Framework_Warning;
1010

1111
/**
12-
* Basic TestListener implementation for use with PHPUnit 5.x.
12+
* Basic TestListener implementation for use with PHPUnit 4.x and 5.x.
1313
*
1414
* This TestListener trait uses renamed (snakecase) methods for all standard methods in
1515
* a TestListener to get round the method signature changes in various PHPUnit versions.
@@ -20,8 +20,8 @@
2020
* {@internal While in essence this trait is no different from the PHPUnit 6.x version, this
2121
* version is necessary as the class/interface name type declarations used in the PHPUnit 6.x
2222
* file are based on the namespaced names. As both the namespaced names as well as the
23-
* non-namespaced names exist in PHPUnit 5.7.21+, we cannot create class aliases to get
24-
* round the signature mismatch and need this trait using the old names instead.}
23+
* non-namespaced names exist in PHPUnit 4.8.36+/5.7.21+, we cannot create class aliases to
24+
* get round the signature mismatch and need this trait using the old names instead.}
2525
*/
2626
trait TestListenerDefaultImplementation {
2727

0 commit comments

Comments
 (0)