diff --git a/.travis.yml b/.travis.yml index a0d6bebd383..4d349482f4d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,8 @@ php: - 5.4 - 5.5 - 5.6 + - "7.0" + - "7.1" env: matrix: diff --git a/src/Extensions/TicketListener.php b/src/Extensions/TicketListener.php index e282f8bc0c0..5e9cd7dfff9 100644 --- a/src/Extensions/TicketListener.php +++ b/src/Extensions/TicketListener.php @@ -29,10 +29,10 @@ abstract class PHPUnit_Extensions_TicketListener implements PHPUnit_Framework_Te * An error occurred. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time */ - public function addError(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addError(PHPUnit_Framework_Test $test, $e, $time) { } @@ -51,10 +51,10 @@ public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_Asser * Incomplete test. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time */ - public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addIncompleteTest(PHPUnit_Framework_Test $test, $e, $time) { } @@ -62,12 +62,12 @@ public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $t * Risky test. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time * * @since Method available since Release 4.0.0 */ - public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addRiskyTest(PHPUnit_Framework_Test $test, $e, $time) { } @@ -75,12 +75,12 @@ public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) * Skipped test. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time * * @since Method available since Release 3.0.0 */ - public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addSkippedTest(PHPUnit_Framework_Test $test, $e, $time) { } diff --git a/src/Framework/BaseTestListener.php b/src/Framework/BaseTestListener.php index c6e5d7734bc..a3f0336fc0b 100644 --- a/src/Framework/BaseTestListener.php +++ b/src/Framework/BaseTestListener.php @@ -17,7 +17,7 @@ */ abstract class PHPUnit_Framework_BaseTestListener implements PHPUnit_Framework_TestListener { - public function addError(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addError(PHPUnit_Framework_Test $test, $e, $time) { } @@ -25,15 +25,15 @@ public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_Asser { } - public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addIncompleteTest(PHPUnit_Framework_Test $test, $e, $time) { } - public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addRiskyTest(PHPUnit_Framework_Test $test, $e, $time) { } - public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addSkippedTest(PHPUnit_Framework_Test $test, $e, $time) { } diff --git a/src/Framework/TestFailure.php b/src/Framework/TestFailure.php index ef3d9cbd27c..c527a134296 100644 --- a/src/Framework/TestFailure.php +++ b/src/Framework/TestFailure.php @@ -34,9 +34,9 @@ class PHPUnit_Framework_TestFailure * Constructs a TestFailure with the given test and exception. * * @param PHPUnit_Framework_Test $failedTest - * @param Exception $thrownException + * @param \Exception|\Throwable $thrownException */ - public function __construct(PHPUnit_Framework_Test $failedTest, Exception $thrownException) + public function __construct(PHPUnit_Framework_Test $failedTest, $thrownException) { if ($failedTest instanceof PHPUnit_Framework_SelfDescribing) { $this->testName = $failedTest->toString(); diff --git a/src/Framework/TestListener.php b/src/Framework/TestListener.php index 8e5829beba9..0e3c477686c 100644 --- a/src/Framework/TestListener.php +++ b/src/Framework/TestListener.php @@ -19,10 +19,10 @@ interface PHPUnit_Framework_TestListener * An error occurred. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time */ - public function addError(PHPUnit_Framework_Test $test, Exception $e, $time); + public function addError(PHPUnit_Framework_Test $test, $e, $time); /** * A failure occurred. @@ -37,32 +37,32 @@ public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_Asser * Incomplete test. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time */ - public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time); + public function addIncompleteTest(PHPUnit_Framework_Test $test, $e, $time); /** * Risky test. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time * * @since Method available since Release 4.0.0 */ - public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time); + public function addRiskyTest(PHPUnit_Framework_Test $test, $e, $time); /** * Skipped test. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time * * @since Method available since Release 3.0.0 */ - public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time); + public function addSkippedTest(PHPUnit_Framework_Test $test, $e, $time); /** * A test suite started. diff --git a/src/TextUI/ResultPrinter.php b/src/TextUI/ResultPrinter.php index e4f02cde3e5..116943a4521 100644 --- a/src/TextUI/ResultPrinter.php +++ b/src/TextUI/ResultPrinter.php @@ -388,10 +388,10 @@ public function printWaitPrompt() * An error occurred. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time */ - public function addError(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addError(PHPUnit_Framework_Test $test, $e, $time) { $this->writeProgressWithColor('fg-red, bold', 'E'); $this->lastTestFailed = true; @@ -414,10 +414,10 @@ public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_Asser * Incomplete test. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time */ - public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addIncompleteTest(PHPUnit_Framework_Test $test, $e, $time) { $this->writeProgressWithColor('fg-yellow, bold', 'I'); $this->lastTestFailed = true; @@ -427,12 +427,12 @@ public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $t * Risky test. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time * * @since Method available since Release 4.0.0 */ - public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addRiskyTest(PHPUnit_Framework_Test $test, $e, $time) { $this->writeProgressWithColor('fg-yellow, bold', 'R'); $this->lastTestFailed = true; @@ -442,12 +442,12 @@ public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) * Skipped test. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time * * @since Method available since Release 3.0.0 */ - public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addSkippedTest(PHPUnit_Framework_Test $test, $e, $time) { $this->writeProgressWithColor('fg-cyan, bold', 'S'); $this->lastTestFailed = true; diff --git a/src/Util/Log/JSON.php b/src/Util/Log/JSON.php index 776bad97ec7..02819a07fe5 100644 --- a/src/Util/Log/JSON.php +++ b/src/Util/Log/JSON.php @@ -34,10 +34,10 @@ class PHPUnit_Util_Log_JSON extends PHPUnit_Util_Printer implements PHPUnit_Fram * An error occurred. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time */ - public function addError(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addError(PHPUnit_Framework_Test $test, $e, $time) { $this->writeCase( 'error', @@ -74,10 +74,10 @@ public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_Asser * Incomplete test. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time */ - public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addIncompleteTest(PHPUnit_Framework_Test $test, $e, $time) { $this->writeCase( 'error', @@ -94,12 +94,12 @@ public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $t * Risky test. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time * * @since Method available since Release 4.0.0 */ - public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addRiskyTest(PHPUnit_Framework_Test $test, $e, $time) { $this->writeCase( 'error', @@ -116,10 +116,10 @@ public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) * Skipped test. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time */ - public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addSkippedTest(PHPUnit_Framework_Test $test, $e, $time) { $this->writeCase( 'error', diff --git a/src/Util/Log/JUnit.php b/src/Util/Log/JUnit.php index 6b68405b93d..850607676ce 100644 --- a/src/Util/Log/JUnit.php +++ b/src/Util/Log/JUnit.php @@ -117,10 +117,10 @@ public function flush() * An error occurred. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time */ - public function addError(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addError(PHPUnit_Framework_Test $test, $e, $time) { if ($this->currentTestCase === null) { return; @@ -192,10 +192,10 @@ public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_Asser * Incomplete test. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time */ - public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addIncompleteTest(PHPUnit_Framework_Test $test, $e, $time) { if ($this->logIncompleteSkipped && $this->currentTestCase !== null) { $error = $this->document->createElement( @@ -220,12 +220,12 @@ public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $t * Risky test. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time * * @since Method available since Release 4.0.0 */ - public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addRiskyTest(PHPUnit_Framework_Test $test, $e, $time) { if ($this->logIncompleteSkipped && $this->currentTestCase !== null) { $error = $this->document->createElement( @@ -250,12 +250,12 @@ public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) * Skipped test. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time * * @since Method available since Release 3.0.0 */ - public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addSkippedTest(PHPUnit_Framework_Test $test, $e, $time) { if ($this->logIncompleteSkipped && $this->currentTestCase !== null) { $error = $this->document->createElement( diff --git a/src/Util/Log/TAP.php b/src/Util/Log/TAP.php index bcd587f4362..d83c5b8b272 100644 --- a/src/Util/Log/TAP.php +++ b/src/Util/Log/TAP.php @@ -50,10 +50,10 @@ public function __construct($out = null) * An error occurred. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time */ - public function addError(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addError(PHPUnit_Framework_Test $test, $e, $time) { $this->writeNotOk($test, 'Error'); } @@ -104,10 +104,10 @@ public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_Asser * Incomplete test. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time */ - public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addIncompleteTest(PHPUnit_Framework_Test $test, $e, $time) { $this->writeNotOk($test, '', 'TODO Incomplete Test'); } @@ -116,12 +116,12 @@ public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $t * Risky test. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time * * @since Method available since Release 4.0.0 */ - public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addRiskyTest(PHPUnit_Framework_Test $test, $e, $time) { $this->write( sprintf( @@ -138,12 +138,12 @@ public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) * Skipped test. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time * * @since Method available since Release 3.0.0 */ - public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addSkippedTest(PHPUnit_Framework_Test $test, $e, $time) { $this->write( sprintf( diff --git a/src/Util/TestDox/ResultPrinter.php b/src/Util/TestDox/ResultPrinter.php index 8511c2dace6..f4a048e1df7 100644 --- a/src/Util/TestDox/ResultPrinter.php +++ b/src/Util/TestDox/ResultPrinter.php @@ -98,10 +98,10 @@ public function flush() * An error occurred. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time */ - public function addError(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addError(PHPUnit_Framework_Test $test, $e, $time) { if (!$this->isOfInterest($test)) { return; @@ -132,10 +132,10 @@ public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_Asser * Incomplete test. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time */ - public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addIncompleteTest(PHPUnit_Framework_Test $test, $e, $time) { if (!$this->isOfInterest($test)) { return; @@ -149,12 +149,12 @@ public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $t * Risky test. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time * * @since Method available since Release 4.0.0 */ - public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addRiskyTest(PHPUnit_Framework_Test $test, $e, $time) { if (!$this->isOfInterest($test)) { return; @@ -168,12 +168,12 @@ public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) * Skipped test. * * @param PHPUnit_Framework_Test $test - * @param Exception $e + * @param \Exception|\Throwable $e * @param float $time * * @since Method available since Release 3.0.0 */ - public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addSkippedTest(PHPUnit_Framework_Test $test, $e, $time) { if (!$this->isOfInterest($test)) { return; diff --git a/tests/Framework/TestListenerTest.php b/tests/Framework/TestListenerTest.php index 589741bfd0b..0d3145fc590 100644 --- a/tests/Framework/TestListenerTest.php +++ b/tests/Framework/TestListenerTest.php @@ -23,8 +23,9 @@ class Framework_TestListenerTest extends PHPUnit_Framework_TestCase implements P protected $result; protected $startCount; - public function addError(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addError(PHPUnit_Framework_Test $test, $e, $time) { + assert($e instanceof \Exception || $e instanceof \Error); $this->errorCount++; } @@ -33,17 +34,17 @@ public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_Asser $this->failureCount++; } - public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addIncompleteTest(PHPUnit_Framework_Test $test, $e, $time) { $this->notImplementedCount++; } - public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addRiskyTest(PHPUnit_Framework_Test $test, $e, $time) { $this->riskyCount++; } - public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time) + public function addSkippedTest(PHPUnit_Framework_Test $test, $e, $time) { $this->skippedCount++; }