Skip to content

Commit

Permalink
Converting static calls to TestManager to use Manager instance in the…
Browse files Browse the repository at this point in the history
… TestSuiteDispatcher.

Converting static methods to instance methods.
  • Loading branch information
markstory committed Jan 5, 2010
1 parent e60d742 commit 104086b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
6 changes: 3 additions & 3 deletions cake/tests/lib/cake_test_suite_dispatcher.php
Expand Up @@ -180,12 +180,12 @@ function _parseParams() {
function _runGroupTest() {
$Reporter =& CakeTestSuiteDispatcher::getReporter();
if ('all' == $this->params['group']) {
TestManager::runAllTests($Reporter);
$this->Manager->runAllTests($Reporter);
} else {
if ($this->params['codeCoverage']) {
CodeCoverageManager::start($this->params['group'], $Reporter);
}
TestManager::runGroupTest(ucfirst($this->params['group']), $Reporter);
$this->Manager->runGroupTest(ucfirst($this->params['group']), $Reporter);
if ($this->params['codeCoverage']) {
CodeCoverageManager::report();
}
Expand All @@ -205,7 +205,7 @@ function _runTestCase() {
CodeCoverageManager::start($_GET['case'], $Reporter);
}

TestManager::runTestCase($_GET['case'], $Reporter);
$this->Manager->runTestCase($_GET['case'], $Reporter);

if ($this->params['codeCoverage']) {
CodeCoverageManager::report();
Expand Down
11 changes: 4 additions & 7 deletions cake/tests/lib/test_manager.php
Expand Up @@ -131,9 +131,7 @@ function runAllTests(&$reporter, $testing = false) {
* @access public
*/
function runTestCase($testCaseFile, &$reporter, $testing = false) {
$manager =& new TestManager();

$testCaseFileWithPath = $manager->_getTestsPath() . DS . $testCaseFile;
$testCaseFileWithPath = $this->_getTestsPath() . DS . $testCaseFile;

if (!file_exists($testCaseFileWithPath)) {
trigger_error("Test case {$testCaseFile} cannot be found", E_USER_ERROR);
Expand All @@ -158,16 +156,15 @@ function runTestCase($testCaseFile, &$reporter, $testing = false) {
* @access public
*/
function runGroupTest($groupTestName, &$reporter) {
$manager =& new TestManager();
$filePath = $manager->_getTestsPath('groups') . DS . strtolower($groupTestName) . $manager->_groupExtension;
$filePath = $this->_getTestsPath('groups') . DS . strtolower($groupTestName) . $this->_groupExtension;

if (!file_exists($filePath)) {
trigger_error("Group test {$groupTestName} cannot be found at {$filePath}", E_USER_ERROR);
}

require_once $filePath;
$test =& new TestSuite($groupTestName . ' group test');
foreach ($manager->_getGroupTestClassNames($filePath) as $groupTest) {
foreach ($this->_getGroupTestClassNames($filePath) as $groupTest) {
$testCase = new $groupTest();
$test->addTestCase($testCase);
if (isset($testCase->label)) {
Expand Down Expand Up @@ -582,8 +579,8 @@ function getBaseURL() {
* @access public
*/
function &getGroupTestList() {
$urlExtra = '';
$manager =& new HtmlTestManager();
$urlExtra = '';
$groupTests =& $manager->_getTestGroupList($manager->_getTestsPath('groups'));

$buffer = "<h3>Core Test Groups:</h3>\n<ul>";
Expand Down

0 comments on commit 104086b

Please sign in to comment.