diff --git a/cake/tests/lib/cake_test_suite.php b/cake/tests/lib/cake_test_suite.php index 47818ca3d..bf93fd7e6 100644 --- a/cake/tests/lib/cake_test_suite.php +++ b/cake/tests/lib/cake_test_suite.php @@ -54,6 +54,24 @@ class CakeTestSuite extends PHPUnit_Framework_TestSuite { } } +/** + * Recursively adds all the files in a directory to the test suite. + * + * @param string $directory The directory subtree to add tests from. + * @return void + */ + public function addTestDirectoryRecursive($directory = '.') { + $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)); + + foreach ($files as $file) { + if (!$file->isFile()) { + continue; + } + $file = $file->getRealPath(); + $this->addTestFile($file); + } + } + /** * Method that is called before the tests of this test suite are run. * It will load fixtures accordingly for each test diff --git a/cake/tests/lib/test_manager.php b/cake/tests/lib/test_manager.php index f9e274510..0d4da19c8 100644 --- a/cake/tests/lib/test_manager.php +++ b/cake/tests/lib/test_manager.php @@ -106,30 +106,6 @@ class TestManager { } } -/** - * Runs all tests in the Application depending on the current appTest setting - * - * @param PHPUnit_Framework_TestListener $reporter Reporter instance to attach to the test case. - * @return mixed - */ - public function runAllTests(&$reporter) { - $testCases = $this->_getTestFileList($this->_getTestsPath($reporter->params)); - - if ($this->appTest) { - $test = $this->getTestSuite(__('All App Tests', true)); - } else if ($this->pluginTest) { - $test = $this->getTestSuite(sprintf(__('All %s Plugin Tests', true), Inflector::humanize($this->pluginTest))); - } else { - $test = $this->getTestSuite(__('All Core Tests', true)); - } - - foreach ($testCases as $testCase) { - $test->addTestFile($testCase); - } - - return $this->run($reporter); - } - /** * Runs a specific test case file * @@ -186,38 +162,6 @@ class TestManager { return $suite; } -/** - * Adds all testcases in a given directory to a given GroupTest object - * - * @param object $groupTest Instance of TestSuite/GroupTest that files are to be added to. - * @param string $directory The directory to add tests from. - * @return void - * @access public - * @static - */ - public static function addTestCasesFromDirectory(&$groupTest, $directory = '.') { - $testCases = self::_getTestFileList($directory); - foreach ($testCases as $testCase) { - $groupTest->addTestFile($testCase); - } - } - -/** - * Adds a specific test file and thereby all of its test cases and group tests to a given group test file - * - * @param object $groupTest Instance of TestSuite/GroupTest that a file should be added to. - * @param string $file The file name, minus the suffix to add. - * @return void - * @access public - * @static - */ - public static function addTestFile(&$groupTest, $file) { - if (file_exists($file . self::$_testExtension)) { - $file .= self::$_testExtension; - } - $groupTest->addTestFile($file); - } - /** * Returns a list of test cases found in the current valid test case path *