diff --git a/src/Listener.php b/src/Listener.php index 99a7cf9..6a127cb 100644 --- a/src/Listener.php +++ b/src/Listener.php @@ -53,6 +53,8 @@ public function addError(\PHPUnit\Framework\Test $test, \Throwable $e, float $ti // This method was added in PHPUnit 6 public function addWarning(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\Warning $e, float $time) : void { + $this->unsuccessfulTests[] = spl_object_hash($test); + $this->fire(Events::TEST_WARNING, new FailEvent($test, $time, $e)); } public function addIncompleteTest(\PHPUnit\Framework\Test $test, \Throwable $e, float $time) : void diff --git a/src/ResultPrinter.php b/src/ResultPrinter.php index e72d5b6..0e41c58 100644 --- a/src/ResultPrinter.php +++ b/src/ResultPrinter.php @@ -33,6 +33,19 @@ public function addFailure(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\Ass $this->failed++; } + /** + * A warning occurred. + * + * @param \PHPUnit\Framework\Test $test + * @param \PHPUnit\Framework\Warning $e + * @param float $time + */ + public function addWarning(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\Warning $e, float $time): void + { + $this->testStatus = \PHPUnit\Runner\BaseTestRunner::STATUS_WARNING; + $this->warned++; + } + /** * Incomplete test. * diff --git a/src/ResultPrinter/UI.php b/src/ResultPrinter/UI.php index 22c1c32..e5acc2f 100644 --- a/src/ResultPrinter/UI.php +++ b/src/ResultPrinter/UI.php @@ -83,6 +83,11 @@ public function addFailure(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\Ass $this->lastTestFailed = true; } + public function addWarning(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\Warning $e, float $time) : void + { + $this->lastTestFailed = true; + } + public function addIncompleteTest(\PHPUnit\Framework\Test $test, \Throwable $e, float $time) : void { $this->lastTestFailed = true;