diff --git a/src/Listener.php b/src/Listener.php index 9b8908c..e697d64 100644 --- a/src/Listener.php +++ b/src/Listener.php @@ -53,6 +53,8 @@ public function addError(\PHPUnit\Framework\Test $test, \Exception $e, $time) // This method was added in PHPUnit 6 public function addWarning(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\Warning $e, $time) { + $this->unsuccessfulTests[] = spl_object_hash($test); + $this->fire(Events::TEST_WARNING, new FailEvent($test, $time, $e)); } public function addIncompleteTest(\PHPUnit\Framework\Test $test, \Exception $e, $time) diff --git a/src/ResultPrinter.php b/src/ResultPrinter.php index 468061c..10f5f67 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, $time) + { + $this->testStatus = \PHPUnit\Runner\BaseTestRunner::STATUS_WARNING; + $this->warned++; + } + /** * Incomplete test. * diff --git a/src/ResultPrinter/UI.php b/src/ResultPrinter/UI.php index 48f3e8b..8a694f2 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, $time) + { + $this->lastTestFailed = true; + } + public function addIncompleteTest(\PHPUnit\Framework\Test $test, \Exception $e, $time) { $this->lastTestFailed = true;