Skip to content

Commit

Permalink
Improve support of PHPUnit warning status (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
edno authored and DavertMik committed Mar 31, 2018
1 parent b3d16b1 commit e8528cb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions src/ResultPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
5 changes: 5 additions & 0 deletions src/ResultPrinter/UI.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e8528cb

Please sign in to comment.