Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Improve support of PHPUnit warning status (7.0) #22

Merged
merged 1 commit into from
Mar 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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