mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Removing methods from TestManager and putting them into CakeTestSuite.
This commit is contained in:
parent
8e6277c9d1
commit
d7b5e12b85
2 changed files with 18 additions and 56 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue