Skip to content

Commit

Permalink
Add PHPUnit_Framework_TestCase::hasFailed() which can be used in a te…
Browse files Browse the repository at this point in the history
…arDown() method, for instance, to check whether the current test has failed.
  • Loading branch information
sebastianbergmann committed Aug 8, 2006
1 parent 8130844 commit fcaec45
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions PHPUnit/Framework/TestCase.php
Expand Up @@ -119,6 +119,12 @@ abstract class PHPUnit_Framework_TestCase extends PHPUnit_Framework_Assert imple
*/
private $name = NULL;

/*
* @var boolean
* @access private
*/
private $failed = FALSE;

/**
* @var Array
* @access private
Expand Down Expand Up @@ -184,6 +190,17 @@ public function getName()
return $this->name;
}

/**
* Returns whether or not this test has failed.
*
* @return boolean
* @since Method available since Release 3.0.0
*/
public function hasFailed()
{
return $this->failed;
}

/**
* Runs the test case and collects the results in a TestResult object.
* If no TestResult object is passed a new one will be created.
Expand Down Expand Up @@ -233,6 +250,10 @@ public function runBare()
$catchedException = $e;
}

if ($catchedException !== NULL) {
$this->failed = TRUE;
}

// Tear down the fixture.
$this->tearDown();

Expand Down
2 changes: 2 additions & 0 deletions package.xml
Expand Up @@ -47,6 +47,8 @@ User-Visible Changes
+ Added PHPUnit_Framework_TestCase::iniSet() as a wrapper for the ini_set() function that automatically resets the modified php.ini setting to its original value after the test is run.
+ Added PHPUnit_Framework_TestCase::hasFailed() which can be used in a tearDown() method, for instance, to check whether the current test has failed.
+ Added a TestListener that talks via a socket connection to Eclipse, developed by Steven Balthazor.
+ Added a TestListener that generates a map of the executed tests in GraphViz markup.
Expand Down

0 comments on commit fcaec45

Please sign in to comment.