Refactoring CakeTestCase so that skipIf() can also be called from within tests

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6930 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2008-05-18 20:17:28 +00:00
parent f900ecc1ef
commit fe3f899f46

View file

@ -129,6 +129,16 @@ class CakeTestCase extends UnitTestCase {
function endTest($method) { function endTest($method) {
} }
/**
* Overrides SimpleTestCase::assert to enable calling of skipIf() from within tests
*/
function assert(&$expectation, $compare, $message = '%s') {
if ($this->_should_skip) {
return;
}
return parent::assert($expectation, $compare, $message);
}
/** /**
* Callback issued when a controller's action is about to be invoked through testAction(). * Callback issued when a controller's action is about to be invoked through testAction().
* *
@ -380,6 +390,7 @@ class CakeTestCase extends UnitTestCase {
if (!in_array(strtolower($method), $this->methods)) { if (!in_array(strtolower($method), $this->methods)) {
$this->endTest($method); $this->endTest($method);
} }
$this->_should_skip = false;
parent::after($method); parent::after($method);
} }