mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 02:26:17 +00:00
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:
parent
f900ecc1ef
commit
fe3f899f46
1 changed files with 11 additions and 0 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue