From fe3f899f468cf5f33dff4a09dae29cae98becc8a Mon Sep 17 00:00:00 2001 From: nate Date: Sun, 18 May 2008 20:17:28 +0000 Subject: [PATCH] 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 --- cake/tests/lib/cake_test_case.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cake/tests/lib/cake_test_case.php b/cake/tests/lib/cake_test_case.php index 90877f6f1..5e0c37aa9 100644 --- a/cake/tests/lib/cake_test_case.php +++ b/cake/tests/lib/cake_test_case.php @@ -129,6 +129,16 @@ class CakeTestCase extends UnitTestCase { 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(). * @@ -380,6 +390,7 @@ class CakeTestCase extends UnitTestCase { if (!in_array(strtolower($method), $this->methods)) { $this->endTest($method); } + $this->_should_skip = false; parent::after($method); }