From 5b999e6d792d3cd748cbfb99ad238271de19aaa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Lorenzo=20Rodr=C3=ADguez?= Date: Wed, 7 Jul 2010 00:05:30 -0430 Subject: [PATCH] Renaming and refactoring method for checking existence of PHPUnit test framework --- cake/tests/lib/cake_test_suite_dispatcher.php | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/cake/tests/lib/cake_test_suite_dispatcher.php b/cake/tests/lib/cake_test_suite_dispatcher.php index f0d05d3e0..f7f1ed9db 100644 --- a/cake/tests/lib/cake_test_suite_dispatcher.php +++ b/cake/tests/lib/cake_test_suite_dispatcher.php @@ -118,7 +118,21 @@ class CakeTestSuiteDispatcher { * * @return void */ - function _checkPHPUnit() { + protected function _checkPHPUnit() { + $found = $this->loadTestFramework(); + if (!$found) { + $baseDir = $this->_baseDir; + include CAKE_TESTS_LIB . 'templates/phpunit.php'; + exit(); + } + } + +/** + * Checks for the existence of the test framework files + * + * @return boolean true if found, false otherwise + */ + public function loadTestFramework() { $found = $path = null; if (@include 'PHPUnit' . DS . 'Framework.php') { @@ -136,14 +150,10 @@ class CakeTestSuiteDispatcher { $found = include 'PHPUnit' . DS . 'Framework.php'; } } - - if (!$found) { - $baseDir = $this->_baseDir; - include CAKE_TESTS_LIB . 'templates/phpunit.php'; - exit(); + if ($found) { + PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'DEFAULT'); } - - PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'DEFAULT'); + return $found; } /**