Skip to content

Commit

Permalink
Merge pull request #1359 from sun/result-isolation-bc
Browse files Browse the repository at this point in the history
Follow-up to #1351: Restore TestFailure::failedTest()
  • Loading branch information
whatthejeff committed Jul 27, 2014
2 parents 2608a34 + a320de5 commit 8a68c88
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 8a68c88

Please sign in to comment.