-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Use PHPUnit 9.x with PHP 7.3+ (#930)
This is required to be able to test against PHP 8. However, PHPUnit 9.x requires PHP 7.3, so a different version of PHPUnit is required for different testing environments. The main change here is a step in the GitHub Action to conditionally update PHPUnit via PHIVE for PHP >=7.3. PHIVE does not yet have the ability for conditional installs (see phar-io/phive#295 (comment)) so the script must check the PHP version before running the update. PHIVE has also been added to the tools (self-referencing) as it is not available by default to GitHub Actions. Note: There are warnings from PHPUnit 9.x about use of deprecated `assert` methods (which will be removed in PHPUnit 10.x). However, these don't cause the tests to fail, and the replacement methods are not available in PHPUnit 7.x which is still required to test against PHP 7.1 and 7.2. Part of #925/#926.
- Loading branch information
Showing
5 changed files
with
1,045 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phive xmlns="https://phar.io/phive"> | ||
<phar name="phar-io/phive" version="^0.14.4" installed="0.14.4" location="./tools/phive.phar" copy="true"/> | ||
<phar name="php-cs-fixer" version="^2.16" installed="2.16.3" location="./tools/php-cs-fixer.phar" copy="true"/> | ||
<phar name="phpmd" version="^2.8" installed="2.8.2" location="./tools/phpmd.phar" copy="true"/> | ||
<phar name="phpunit" version="^7.5" installed="7.5.20" location="./tools/phpunit.phar" copy="true"/> | ||
<phar name="phpunit" version="^7.5.20 || ^9.4.3" installed="7.5.20" location="./tools/phpunit.phar" copy="true"/> | ||
<phar name="psalm" version="^3.11.5" installed="3.11.5" location="./tools/psalm.phar" copy="true"/> | ||
</phive> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,10 @@ | |
* Due to {@link https://bugs.php.net/bug.php?id=75060 PHP 'bug' #75060}, traits cannot have constants, so, as a | ||
* workaround, this is currently implemented as a base class (but ideally would be a `trait`). | ||
* | ||
* Since, then, this is a class, and PHPUnit's `Constraint` class may or may not have a constructor (it did prior to | ||
* 8.x, but does not since) which must be called if it exists, this class also provides an explicit constructor which | ||
* will invoke the parent's constructor if there is one. | ||
* | ||
* @author Jake Hotson <[email protected]> | ||
*/ | ||
abstract class CssConstraint extends Constraint | ||
|
@@ -74,4 +78,14 @@ private static function getCssNeedleRegularExpressionReplacement(array $matches) | |
|
||
return $regularExpressionEquivalent; | ||
} | ||
|
||
/** | ||
* Invokes the parent class's constructor if there is one. | ||
*/ | ||
public function __construct() | ||
{ | ||
if (\is_callable('parent::__construct')) { | ||
parent::__construct(); | ||
} | ||
} | ||
} |
Oops, something went wrong.