Skip to content

Commit

Permalink
Fix sebastianbergmann#1351: Add back TestFailure::failedTest() for BC.
Browse files Browse the repository at this point in the history
  • Loading branch information
sun committed Jul 27, 2014
1 parent 2608a34 commit a320de5
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/Framework/TestFailure.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ class PHPUnit_Framework_TestFailure
*/
private $testName;

/**
* @var PHPUnit_Framework_Test|null
*/
protected $failedTest;

/**
* @var Exception
*/
Expand All @@ -79,6 +84,9 @@ public function __construct(PHPUnit_Framework_Test $failedTest, Exception $throw
} else {
$this->testName = get_class($failedTest);
}
if (!$failedTest instanceof PHPUnit_Framework_TestCase || !$failedTest->isInIsolation()) {
$this->failedTest = $failedTest;
}
$this->thrownException = $thrownException;
}

Expand Down Expand Up @@ -147,6 +155,21 @@ public function getTestName()
return $this->testName;
}

/**
* Returns the failing test.
*
* Note: The test object is not set when the test is executed in process
* isolation.
*
* @see PHPUnit_Framework_Exception
*
* @return PHPUnit_Framework_Test|null
*/
public function failedTest()
{
return $this->failedTest;
}

/**
* Gets the thrown exception.
*
Expand Down

0 comments on commit a320de5

Please sign in to comment.