diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 885fe3d3945..9fd4b8b6236 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,17 +14,14 @@ jobs: fail-fast: false matrix: php: - - "5.3" - - "5.4" - - "5.5" - - "5.6" - - "7.0" - "7.1" - "7.2" - "7.3" - "8.0" - "8.1" - "8.2" + - "8.3" + - "8.4" php_invoker: [true, false] coverage: [false] experimental: [false] diff --git a/PHPUnit/Extensions/PhptTestCase.php b/PHPUnit/Extensions/PhptTestCase.php index bb66bdc23eb..ec10038cb45 100644 --- a/PHPUnit/Extensions/PhptTestCase.php +++ b/PHPUnit/Extensions/PhptTestCase.php @@ -115,11 +115,11 @@ public function count() /** * Runs a test and collects its result in a TestResult instance. * - * @param PHPUnit_Framework_TestResult $result + * @param ?PHPUnit_Framework_TestResult $result * @param array $options * @return PHPUnit_Framework_TestResult */ - public function run(PHPUnit_Framework_TestResult $result = NULL, array $options = array()) + public function run(?PHPUnit_Framework_TestResult $result = NULL, array $options = array()) { if (!class_exists('PEAR_RunTest', FALSE)) { throw new PHPUnit_Framework_Exception('Class PEAR_RunTest not found.'); diff --git a/PHPUnit/Extensions/RepeatedTest.php b/PHPUnit/Extensions/RepeatedTest.php index ea6dcc5415e..bf1cf5b2eb2 100644 --- a/PHPUnit/Extensions/RepeatedTest.php +++ b/PHPUnit/Extensions/RepeatedTest.php @@ -125,11 +125,11 @@ public function count() * Runs the decorated test and collects the * result in a TestResult. * - * @param PHPUnit_Framework_TestResult $result + * @param ?PHPUnit_Framework_TestResult $result * @return PHPUnit_Framework_TestResult * @throws PHPUnit_Framework_Exception */ - public function run(PHPUnit_Framework_TestResult $result = NULL) + public function run(?PHPUnit_Framework_TestResult $result = NULL) { if ($result === NULL) { $result = $this->createResult(); diff --git a/PHPUnit/Extensions/TestDecorator.php b/PHPUnit/Extensions/TestDecorator.php index 18f0b13e9b1..5b19c22825b 100644 --- a/PHPUnit/Extensions/TestDecorator.php +++ b/PHPUnit/Extensions/TestDecorator.php @@ -134,10 +134,10 @@ public function getTest() * Runs the decorated test and collects the * result in a TestResult. * - * @param PHPUnit_Framework_TestResult $result + * @param ?PHPUnit_Framework_TestResult $result * @return PHPUnit_Framework_TestResult */ - public function run(PHPUnit_Framework_TestResult $result = NULL) + public function run(?PHPUnit_Framework_TestResult $result = NULL) { if ($result === NULL) { $result = $this->createResult(); diff --git a/PHPUnit/Framework/Constraint.php b/PHPUnit/Framework/Constraint.php index ded42147f42..d3b13c38332 100644 --- a/PHPUnit/Framework/Constraint.php +++ b/PHPUnit/Framework/Constraint.php @@ -123,10 +123,10 @@ public function count() * * @param mixed $other Evaluated value or object. * @param string $description Additional information about the test - * @param PHPUnit_Framework_ComparisonFailure $comparisonFailure + * @param ?PHPUnit_Framework_ComparisonFailure $comparisonFailure * @throws PHPUnit_Framework_ExpectationFailedException */ - protected function fail($other, $description, PHPUnit_Framework_ComparisonFailure $comparisonFailure = NULL) + protected function fail($other, $description, ?PHPUnit_Framework_ComparisonFailure $comparisonFailure = NULL) { $failureDescription = sprintf( 'Failed asserting that %s.', diff --git a/PHPUnit/Framework/Error.php b/PHPUnit/Framework/Error.php index c599e18d2ee..014061603af 100644 --- a/PHPUnit/Framework/Error.php +++ b/PHPUnit/Framework/Error.php @@ -63,9 +63,9 @@ class PHPUnit_Framework_Error extends Exception * @param integer $code * @param string $file * @param integer $line - * @param Exception $previous + * @param ?Exception $previous */ - public function __construct($message, $code, $file, $line, Exception $previous = NULL) + public function __construct($message, $code, $file, $line, ?Exception $previous = NULL) { parent::__construct($message, $code, $previous); diff --git a/PHPUnit/Framework/ExpectationFailedException.php b/PHPUnit/Framework/ExpectationFailedException.php index cdb48cbba3f..5fa1ae91300 100644 --- a/PHPUnit/Framework/ExpectationFailedException.php +++ b/PHPUnit/Framework/ExpectationFailedException.php @@ -65,7 +65,7 @@ class PHPUnit_Framework_ExpectationFailedException extends PHPUnit_Framework_Ass */ protected $comparisonFailure; - public function __construct($message, PHPUnit_Framework_ComparisonFailure $comparisonFailure = NULL, Exception $previous = NULL) + public function __construct($message, ?PHPUnit_Framework_ComparisonFailure $comparisonFailure = NULL, ?Exception $previous = NULL) { $this->comparisonFailure = $comparisonFailure; diff --git a/PHPUnit/Framework/Test.php b/PHPUnit/Framework/Test.php index d77af35941a..5c7175e42c1 100644 --- a/PHPUnit/Framework/Test.php +++ b/PHPUnit/Framework/Test.php @@ -59,8 +59,8 @@ interface PHPUnit_Framework_Test extends Countable /** * Runs a test and collects its result in a TestResult instance. * - * @param PHPUnit_Framework_TestResult $result + * @param ?PHPUnit_Framework_TestResult $result * @return PHPUnit_Framework_TestResult */ - public function run(PHPUnit_Framework_TestResult $result = NULL); + public function run(?PHPUnit_Framework_TestResult $result = NULL); } diff --git a/PHPUnit/Framework/TestCase.php b/PHPUnit/Framework/TestCase.php index 51ce9ad1289..f279f374d8b 100644 --- a/PHPUnit/Framework/TestCase.php +++ b/PHPUnit/Framework/TestCase.php @@ -672,11 +672,11 @@ public function hasFailed() * Runs the test case and collects the results in a TestResult object. * If no TestResult object is passed a new one will be created. * - * @param PHPUnit_Framework_TestResult $result + * @param ?PHPUnit_Framework_TestResult $result * @return PHPUnit_Framework_TestResult * @throws PHPUnit_Framework_Exception */ - public function run(PHPUnit_Framework_TestResult $result = NULL) + public function run(?PHPUnit_Framework_TestResult $result = NULL) { if ($result === NULL) { $result = $this->createResult(); diff --git a/PHPUnit/Framework/TestResult.php b/PHPUnit/Framework/TestResult.php index 103e0a505b4..6aac0fe28d0 100644 --- a/PHPUnit/Framework/TestResult.php +++ b/PHPUnit/Framework/TestResult.php @@ -582,7 +582,7 @@ public function run(PHPUnit_Framework_Test $test) if ($this->convertErrorsToExceptions) { $oldErrorHandler = set_error_handler( array('PHPUnit_Util_ErrorHandler', 'handleError'), - E_ALL | E_STRICT + E_ALL ); if ($oldErrorHandler === NULL) { diff --git a/PHPUnit/Framework/TestSuite.php b/PHPUnit/Framework/TestSuite.php index 4faad4ace27..c795480374d 100644 --- a/PHPUnit/Framework/TestSuite.php +++ b/PHPUnit/Framework/TestSuite.php @@ -617,7 +617,7 @@ public function getGroups() /** * Runs the tests and collects their result in a TestResult. * - * @param PHPUnit_Framework_TestResult $result + * @param ?PHPUnit_Framework_TestResult $result * @param mixed $filter * @param array $groups * @param array $excludeGroups @@ -625,7 +625,7 @@ public function getGroups() * @return PHPUnit_Framework_TestResult * @throws PHPUnit_Framework_Exception */ - public function run(PHPUnit_Framework_TestResult $result = NULL, $filter = FALSE, array $groups = array(), array $excludeGroups = array(), $processIsolation = FALSE) + public function run(?PHPUnit_Framework_TestResult $result = NULL, $filter = FALSE, array $groups = array(), array $excludeGroups = array(), $processIsolation = FALSE) { if ($result === NULL) { $result = $this->createResult(); diff --git a/PHPUnit/TextUI/TestRunner.php b/PHPUnit/TextUI/TestRunner.php index d3e273018cd..7c137c98f7d 100644 --- a/PHPUnit/TextUI/TestRunner.php +++ b/PHPUnit/TextUI/TestRunner.php @@ -82,11 +82,11 @@ class PHPUnit_TextUI_TestRunner extends PHPUnit_Runner_BaseTestRunner protected static $versionStringPrinted = FALSE; /** - * @param PHPUnit_Runner_TestSuiteLoader $loader - * @param PHP_CodeCoverage_Filter $filter + * @param ?PHPUnit_Runner_TestSuiteLoader $loader + * @param ?PHP_CodeCoverage_Filter $filter * @since Method available since Release 3.4.0 */ - public function __construct(PHPUnit_Runner_TestSuiteLoader $loader = NULL, PHP_CodeCoverage_Filter $filter = NULL) + public function __construct(?PHPUnit_Runner_TestSuiteLoader $loader = NULL, ?PHP_CodeCoverage_Filter $filter = NULL) { if ($filter === NULL) { $filter = new PHP_CodeCoverage_Filter; diff --git a/PHPUnit/Util/ErrorHandler.php b/PHPUnit/Util/ErrorHandler.php index be311b04294..2fc86b278a2 100644 --- a/PHPUnit/Util/ErrorHandler.php +++ b/PHPUnit/Util/ErrorHandler.php @@ -99,7 +99,7 @@ public static function handleError($errno, $errstr, $errfile, $errline) } } - if ($errno == E_NOTICE || $errno == E_USER_NOTICE || $errno == E_STRICT) { + if ($errno == E_NOTICE || $errno == E_USER_NOTICE) { if (PHPUnit_Framework_Error_Notice::$enabled !== TRUE) { return FALSE; } diff --git a/PHPUnit/Util/GlobalState.php b/PHPUnit/Util/GlobalState.php index 08457fd89ed..677daedebba 100644 --- a/PHPUnit/Util/GlobalState.php +++ b/PHPUnit/Util/GlobalState.php @@ -343,7 +343,7 @@ public static function restoreStaticAttributes() foreach ($staticAttributes as $name => $value) { $reflector = new ReflectionProperty($className, $name); $reflector->setAccessible(TRUE); - $reflector->setValue(unserialize($value)); + $reflector->setValue(null, unserialize($value)); } } diff --git a/PHPUnit/Util/PHP.php b/PHPUnit/Util/PHP.php index 27b7f3790f2..d5b79bef680 100644 --- a/PHPUnit/Util/PHP.php +++ b/PHPUnit/Util/PHP.php @@ -154,12 +154,12 @@ public static function factory() * Runs a single job (PHP code) using a separate PHP process. * * @param string $job - * @param PHPUnit_Framework_TestCase $test - * @param PHPUnit_Framework_TestResult $result + * @param ?PHPUnit_Framework_TestCase $test + * @param ?PHPUnit_Framework_TestResult $result * @return array|null * @throws PHPUnit_Framework_Exception */ - public function runJob($job, PHPUnit_Framework_Test $test = NULL, PHPUnit_Framework_TestResult $result = NULL) + public function runJob($job, ?PHPUnit_Framework_Test $test = NULL, ?PHPUnit_Framework_TestResult $result = NULL) { $process = proc_open( $this->getPhpBinary(), diff --git a/README.md b/README.md index c7f1c2f8493..5e66b8ecf2d 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,9 @@ This version of PHPUnit bases on release 3.7.38 and is adjusted for compatibilit The package was created especially for testing https://github.com/zf1s packages. All credits go to original PHPUnit author and contributors. + +### Running tests +Run all tests: +``` +php phpunit.php --color --stop-on-error --stop-on-failure --stop-on-incomplete +``` \ No newline at end of file diff --git a/Tests/Framework/AssertTest.php b/Tests/Framework/AssertTest.php index b57055f4bd1..5517d48fc31 100644 --- a/Tests/Framework/AssertTest.php +++ b/Tests/Framework/AssertTest.php @@ -66,6 +66,7 @@ class Framework_AssertTest extends PHPUnit_Framework_TestCase { protected $filesDirectory; + protected $html; protected function setUp() { diff --git a/Tests/_files/DoubleTestCase.php b/Tests/_files/DoubleTestCase.php index 1e8380a1d0d..ab20f696687 100644 --- a/Tests/_files/DoubleTestCase.php +++ b/Tests/_files/DoubleTestCase.php @@ -14,7 +14,7 @@ public function count() return 2; } - public function run(PHPUnit_Framework_TestResult $result = NULL) + public function run(?PHPUnit_Framework_TestResult $result = NULL) { $result->startTest($this); diff --git a/composer.json b/composer.json index 0bd52ed7d03..589ed82ef4b 100644 --- a/composer.json +++ b/composer.json @@ -25,14 +25,8 @@ "support": { "issues": "https://github.com/zf1s/phpunit/issues" }, - "repositories": [ - { - "type": "pear", - "url": "https://pear.php.net" - } - ], "require": { - "php": ">=5.3.3", + "php": ">=7.1", "phpunit/php-text-template": "^1.2.1", "phpunit/phpunit-mock-objects": "^1.2.3", "phpunit/php-file-iterator": "^1.4.5", @@ -44,10 +38,8 @@ "ext-json": "*", "ext-pcre": "*", "ext-reflection": "*", - "ext-spl": "*" - }, - "require-dev": { - "pear-pear.php.net/pear": "~1.9|~1.10" + "ext-spl": "*", + "pear/pear": "^1.10" }, "suggest": { "phpunit/php-invoker": "~1.1"