From 10bdc235ee95b9487c08b5e7b707af0766c05f4b Mon Sep 17 00:00:00 2001 From: gwoo Date: Sun, 9 Mar 2008 04:07:56 +0000 Subject: [PATCH] updating test suite for plugins, closes #4107, closes #2777. requires update to test.php. git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6527 3807eeeb-6ff5-0310-8944-8be069107fe0 --- app/webroot/test.php | 171 ++--------- cake/config/paths.php | 13 +- .../libs/templates/skel/webroot/test.php | 171 ++--------- cake/tests/lib/cake_test_case.php | 15 +- cake/tests/lib/content.php | 39 ++- cake/tests/lib/test_manager.php | 288 ++++++++++++++---- 6 files changed, 322 insertions(+), 375 deletions(-) diff --git a/app/webroot/test.php b/app/webroot/test.php index 3716313c3..ca482b010 100644 --- a/app/webroot/test.php +++ b/app/webroot/test.php @@ -69,7 +69,7 @@ if (isset($corePath[0])) { } else { define('TEST_CAKE_CORE_INCLUDE_PATH', CAKE_CORE_INCLUDE_PATH); } -require_once CAKE . 'tests' . DS . 'lib' . DS . 'test_manager.php'; +require_once CAKE_TESTS_LIB . 'test_manager.php'; if (Configure::read('debug') < 1) { die(__('Debug setting does not allow access to this url.', true)); @@ -81,172 +81,45 @@ if (!isset($_SERVER['SERVER_NAME'])) { if (empty( $_GET['output'])) { $_GET['output'] = 'html'; } - -$dispatch =& new Dispatcher(); -$dispatch->baseUrl(); -define('BASE', $dispatch->webroot); - /** * * Used to determine output to display */ -define('CAKE_TEST_OUTPUT_HTML',1); -define('CAKE_TEST_OUTPUT_TEXT',2); +define('CAKE_TEST_OUTPUT_HTML', 1); +define('CAKE_TEST_OUTPUT_TEXT', 2); if (isset($_GET['output']) && $_GET['output'] == 'html') { define('CAKE_TEST_OUTPUT', CAKE_TEST_OUTPUT_HTML); } else { + Debugger::output('txt'); define('CAKE_TEST_OUTPUT', CAKE_TEST_OUTPUT_TEXT); } if (!App::import('Vendor', 'simpletest' . DS . 'reporter')) { CakePHPTestHeader(); - include CAKE . 'tests' . DS . 'lib' . DS . 'simpletest.php'; + include CAKE_TESTS_LIB . 'simpletest.php'; CakePHPTestSuiteFooter(); exit(); } - function &CakeTestsGetReporter() { - static $Reporter = NULL; - if (!$Reporter) { - switch (CAKE_TEST_OUTPUT) { - case CAKE_TEST_OUTPUT_HTML: - require_once LIB_TESTS . 'cake_reporter.php'; - $Reporter = new CakeHtmlReporter(); - break; - default: - $Reporter = new TextReporter(); - break; - } - } - return $Reporter; - } +CakePHPTestHeader(); +CakePHPTestSuiteHeader(); +define('RUN_TEST_LINK', $_SERVER['PHP_SELF']); - function CakePHPTestRunMore() { - switch (CAKE_TEST_OUTPUT) { - case CAKE_TEST_OUTPUT_HTML: - if (isset($_GET['group'])) { - if (isset($_GET['app'])) { - $show = '?show=groups&app=true'; - } else { - $show = '?show=groups'; - } - } - if (isset($_GET['case'])) { - if (isset($_GET['app'])) { - $show = '?show=cases&app=true'; - } else { - $show = '?show=cases'; - } - } - echo "

Run more tests

\n"; - break; - } - } - - function CakePHPTestCaseList() { - switch (CAKE_TEST_OUTPUT) { - case CAKE_TEST_OUTPUT_HTML: - if (isset($_GET['app'])) { - echo HtmlTestManager::getTestCaseList(APP_TEST_CASES); - } else { - echo HtmlTestManager::getTestCaseList(CORE_TEST_CASES); - } - break; - case CAKE_TEST_OUTPUT_TEXT: - default: - if (isset($_GET['app'])) { - echo TextTestManager::getTestCaseList(APP_TEST_CASES); - } else { - echo TextTestManager::getTestCaseList(CORE_TEST_CASES); - } - break; - } - } - - function CakePHPTestGroupTestList() { - switch (CAKE_TEST_OUTPUT) { - case CAKE_TEST_OUTPUT_HTML: - if (isset($_GET['app'])) { - echo HtmlTestManager::getGroupTestList(APP_TEST_GROUPS); - } else { - echo HtmlTestManager::getGroupTestList(CORE_TEST_GROUPS); - } - break; - case CAKE_TEST_OUTPUT_TEXT: - default: - if (isset($_GET['app'])) { - echo TextTestManager::getGroupTestList(APP_TEST_GROUPS); - } else { - echo TextTestManager::getGroupTestList(CORE_TEST_GROUPS); - } - break; - } - } - - function CakePHPTestHeader() { - switch (CAKE_TEST_OUTPUT) { - case CAKE_TEST_OUTPUT_HTML: - $baseUrl = BASE; - $characterSet = 'charset=utf-8'; - include CAKE . 'tests' . DS . 'lib' . DS . 'header.php'; - break; - case CAKE_TEST_OUTPUT_TEXT: - default: - header(' content-type: text/plain'); - break; - } - } - - function CakePHPTestSuiteHeader() { - switch (CAKE_TEST_OUTPUT) { - case CAKE_TEST_OUTPUT_HTML: - $groups = $_SERVER['PHP_SELF'].'?show=groups'; - $cases = $_SERVER['PHP_SELF'].'?show=cases'; - include CAKE . 'tests' . DS . 'lib' . DS . 'content.php'; - break; - } - } - - function CakePHPTestSuiteFooter() { - switch ( CAKE_TEST_OUTPUT) { - case CAKE_TEST_OUTPUT_HTML: - $baseUrl = BASE; - include CAKE . 'tests' . DS . 'lib' . DS . 'footer.php'; - break; - } - } - - CakePHPTestHeader(); - CakePHPTestSuiteHeader(); - define('RUN_TEST_LINK', $_SERVER['PHP_SELF']); - - if (isset($_GET['group'])) { - if ('all' == $_GET['group']) { - TestManager::runAllTests(CakeTestsGetReporter()); - } else { - if (isset($_GET['app'])) { - TestManager::runGroupTest(ucfirst($_GET['group']), APP_TEST_GROUPS, CakeTestsGetReporter()); - } else { - TestManager::runGroupTest(ucfirst($_GET['group']), CORE_TEST_GROUPS, CakeTestsGetReporter()); - } - } - CakePHPTestRunMore(); - CakePHPTestSuiteFooter(); - exit(); - } - - if (isset($_GET['case'])) { - TestManager::runTestCase($_GET['case'], CakeTestsGetReporter()); - CakePHPTestRunMore(); - CakePHPTestSuiteFooter(); - exit(); - } - - if (isset($_GET['show']) && $_GET['show'] == 'cases') { - CakePHPTestCaseList(); +if (isset($_GET['group'])) { + if ('all' == $_GET['group']) { + TestManager::runAllTests(CakeTestsGetReporter()); } else { - CakePHPTestGroupTestList(); + TestManager::runGroupTest(ucfirst($_GET['group']), CakeTestsGetReporter()); } - CakePHPTestSuiteFooter(); + CakePHPTestRunMore(); +} elseif (isset($_GET['case'])) { + TestManager::runTestCase($_GET['case'], CakeTestsGetReporter()); + CakePHPTestRunMore(); +}elseif (isset($_GET['show']) && $_GET['show'] == 'cases') { + CakePHPTestCaseList(); +} else { + CakePHPTestGroupTestList(); +} +CakePHPTestSuiteFooter(); ?> \ No newline at end of file diff --git a/cake/config/paths.php b/cake/config/paths.php index 16163193b..f98521fa6 100644 --- a/cake/config/paths.php +++ b/cake/config/paths.php @@ -114,6 +114,17 @@ if (!defined('TESTS')) { define ('TESTS', APP.'tests'.DS); } +/** + * Path to the core tests directory. + */ +if (!defined('CAKE_TESTS')) { + define ('CAKE_TESTS', CAKE.'tests'.DS); +} +/** + * Path to the test suite. + */ + define ('CAKE_TESTS_LIB', CAKE_TESTS.'lib'.DS); + /** * Path to the controller test directory. */ @@ -133,7 +144,7 @@ if (!defined('TESTS')) { /** * Path to the lib test directory. */ - define ('LIB_TESTS', CAKE.'tests'.DS.'lib'.DS); + define ('LIB_TESTS', CAKE_TESTS.'cases'.DS.'lib'.DS); /** * Path to the temporary files directory. */ diff --git a/cake/console/libs/templates/skel/webroot/test.php b/cake/console/libs/templates/skel/webroot/test.php index 514ec070a..ca482b010 100644 --- a/cake/console/libs/templates/skel/webroot/test.php +++ b/cake/console/libs/templates/skel/webroot/test.php @@ -69,7 +69,7 @@ if (isset($corePath[0])) { } else { define('TEST_CAKE_CORE_INCLUDE_PATH', CAKE_CORE_INCLUDE_PATH); } -require_once CAKE . 'tests' . DS . 'lib' . DS . 'test_manager.php'; +require_once CAKE_TESTS_LIB . 'test_manager.php'; if (Configure::read('debug') < 1) { die(__('Debug setting does not allow access to this url.', true)); @@ -81,172 +81,45 @@ if (!isset($_SERVER['SERVER_NAME'])) { if (empty( $_GET['output'])) { $_GET['output'] = 'html'; } - -$dispatch =& new Dispatcher(); -$dispatch->baseUrl(); -define('BASE', $dispatch->webroot); - /** * * Used to determine output to display */ -define('CAKE_TEST_OUTPUT_HTML',1); -define('CAKE_TEST_OUTPUT_TEXT',2); +define('CAKE_TEST_OUTPUT_HTML', 1); +define('CAKE_TEST_OUTPUT_TEXT', 2); if (isset($_GET['output']) && $_GET['output'] == 'html') { define('CAKE_TEST_OUTPUT', CAKE_TEST_OUTPUT_HTML); } else { + Debugger::output('txt'); define('CAKE_TEST_OUTPUT', CAKE_TEST_OUTPUT_TEXT); } if (!App::import('Vendor', 'simpletest' . DS . 'reporter')) { CakePHPTestHeader(); - include CAKE . 'tests' . DS . 'lib' . DS . 'simpletest.php'; + include CAKE_TESTS_LIB . 'simpletest.php'; CakePHPTestSuiteFooter(); exit(); } - function &CakeTestsGetReporter() { - static $Reporter = NULL; - if (!$Reporter) { - switch (CAKE_TEST_OUTPUT) { - case CAKE_TEST_OUTPUT_HTML: - require_once LIB_TESTS . 'cake_reporter.php'; - $Reporter = new CakeHtmlReporter(); - break; - default: - $Reporter = new TextReporter(); - break; - } - } - return $Reporter; - } +CakePHPTestHeader(); +CakePHPTestSuiteHeader(); +define('RUN_TEST_LINK', $_SERVER['PHP_SELF']); - function CakePHPTestRunMore() { - switch (CAKE_TEST_OUTPUT) { - case CAKE_TEST_OUTPUT_HTML: - if (isset($_GET['group'])) { - if (isset($_GET['app'])) { - $show = '?show=groups&app=true'; - } else { - $show = '?show=groups'; - } - } - if (isset($_GET['case'])) { - if (isset($_GET['app'])) { - $show = '??show=cases&app=truee'; - } else { - $show = '?show=cases'; - } - } - echo "

Run more tests

\n"; - break; - } - } - - function CakePHPTestCaseList() { - switch (CAKE_TEST_OUTPUT) { - case CAKE_TEST_OUTPUT_HTML: - if (isset($_GET['app'])) { - echo HtmlTestManager::getTestCaseList(APP_TEST_CASES); - } else { - echo HtmlTestManager::getTestCaseList(CORE_TEST_CASES); - } - break; - case CAKE_TEST_OUTPUT_TEXT: - default: - if (isset($_GET['app'])) { - echo TextTestManager::getTestCaseList(APP_TEST_CASES); - } else { - echo TextTestManager::getTestCaseList(CORE_TEST_CASES); - } - break; - } - } - - function CakePHPTestGroupTestList() { - switch (CAKE_TEST_OUTPUT) { - case CAKE_TEST_OUTPUT_HTML: - if (isset($_GET['app'])) { - echo HtmlTestManager::getGroupTestList(APP_TEST_GROUPS); - } else { - echo HtmlTestManager::getGroupTestList(CORE_TEST_GROUPS); - } - break; - case CAKE_TEST_OUTPUT_TEXT: - default: - if (isset($_GET['app'])) { - echo TextTestManager::getGroupTestList(APP_TEST_GROUPS); - } else { - echo TextTestManager::getGroupTestList(CORE_TEST_GROUPS); - } - break; - } - } - - function CakePHPTestHeader() { - switch (CAKE_TEST_OUTPUT) { - case CAKE_TEST_OUTPUT_HTML: - $baseUrl = BASE; - $characterSet = 'charset=utf-8'; - include CAKE . 'tests' . DS . 'lib' . DS . 'header.php'; - break; - case CAKE_TEST_OUTPUT_TEXT: - default: - header(' content-type: text/plain'); - break; - } - } - - function CakePHPTestSuiteHeader() { - switch (CAKE_TEST_OUTPUT) { - case CAKE_TEST_OUTPUT_HTML: - $groups = $_SERVER['PHP_SELF'].'?show=groups'; - $cases = $_SERVER['PHP_SELF'].'?show=cases'; - include CAKE . 'tests' . DS . 'lib' . DS . 'content.php'; - break; - } - } - - function CakePHPTestSuiteFooter() { - switch ( CAKE_TEST_OUTPUT) { - case CAKE_TEST_OUTPUT_HTML: - $baseUrl = BASE; - include CAKE . 'tests' . DS . 'lib' . DS . 'footer.php'; - break; - } - } - - CakePHPTestHeader(); - CakePHPTestSuiteHeader(); - define('RUN_TEST_LINK', $_SERVER['PHP_SELF']); - - if (isset($_GET['group'])) { - if ('all' == $_GET['group']) { - TestManager::runAllTests(CakeTestsGetReporter()); - } else { - if (isset($_GET['app'])) { - TestManager::runGroupTest(ucfirst($_GET['group']), APP_TEST_GROUPS, CakeTestsGetReporter()); - } else { - TestManager::runGroupTest(ucfirst($_GET['group']), CORE_TEST_GROUPS, CakeTestsGetReporter()); - } - } - CakePHPTestRunMore(); - CakePHPTestSuiteFooter(); - exit(); - } - - if (isset($_GET['case'])) { - TestManager::runTestCase($_GET['case'], CakeTestsGetReporter()); - CakePHPTestRunMore(); - CakePHPTestSuiteFooter(); - exit(); - } - - if (isset($_GET['show']) && $_GET['show'] == 'cases') { - CakePHPTestCaseList(); +if (isset($_GET['group'])) { + if ('all' == $_GET['group']) { + TestManager::runAllTests(CakeTestsGetReporter()); } else { - CakePHPTestGroupTestList(); + TestManager::runGroupTest(ucfirst($_GET['group']), CakeTestsGetReporter()); } - CakePHPTestSuiteFooter(); + CakePHPTestRunMore(); +} elseif (isset($_GET['case'])) { + TestManager::runTestCase($_GET['case'], CakeTestsGetReporter()); + CakePHPTestRunMore(); +}elseif (isset($_GET['show']) && $_GET['show'] == 'cases') { + CakePHPTestCaseList(); +} else { + CakePHPTestGroupTestList(); +} +CakePHPTestSuiteFooter(); ?> \ No newline at end of file diff --git a/cake/tests/lib/cake_test_case.php b/cake/tests/lib/cake_test_case.php index b86f76185..f290cde59 100644 --- a/cake/tests/lib/cake_test_case.php +++ b/cake/tests/lib/cake_test_case.php @@ -26,8 +26,8 @@ * @lastmodified $Date$ * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License */ -require_once CAKE . 'tests' . DS . 'lib' . DS . 'cake_test_model.php'; -require_once CAKE . 'tests' . DS . 'lib' . DS . 'cake_test_fixture.php'; +require_once CAKE_TESTS_LIB . 'cake_test_model.php'; +require_once CAKE_TESTS_LIB . 'cake_test_fixture.php'; !App::import('Vendor', 'simpletest' . DS . 'unit_tester'); /** * Short description for class. @@ -473,7 +473,16 @@ class CakeTestCase extends UnitTestCase { } elseif (strpos($fixture, 'app.') === 0) { $fixture = substr($fixture, strlen('app.')); $fixturePaths = array( - TESTS . DS . 'fixtures', + TESTS . 'fixtures', + VENDORS . 'tests' . DS . 'fixtures' + ); + } elseif (strpos($fixture, 'plugin.') === 0) { + $parts = explode('.', $fixture, 3); + $pluginName = $parts[1]; + $fixture = $parts[2]; + $fixturePaths = array( + APP . 'plugins' . DS . $pluginName . DS . 'tests' . DS . 'fixtures', + TESTS . 'fixtures', VENDORS . 'tests' . DS . 'fixtures' ); } else { diff --git a/cake/tests/lib/content.php b/cake/tests/lib/content.php index bde790b12..fe53719d0 100644 --- a/cake/tests/lib/content.php +++ b/cake/tests/lib/content.php @@ -27,12 +27,39 @@ * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License */ ?> + diff --git a/cake/tests/lib/test_manager.php b/cake/tests/lib/test_manager.php index 48ab5d8f4..9d4b42ec5 100644 --- a/cake/tests/lib/test_manager.php +++ b/cake/tests/lib/test_manager.php @@ -39,34 +39,34 @@ define ('APP_TEST_GROUPS', APP . 'tests' .DS. 'groups'); class TestManager { var $_testExtension = '.test.php'; var $_groupExtension = '.group.php'; - var $usersAppTest = false; + var $appTest = false; + var $pluginTest = false; function TestManager() { $this->_installSimpleTest(); if (isset($_GET['app'])) { - $this->usersAppTest = true; + $this->appTest = true; + } + if (isset($_GET['plugin'])) { + $this->pluginTest = $_GET['plugin']; } } function _installSimpleTest() { App::import('Vendor', array('simpletest'.DS.'unit_tester', 'simpletest'.DS.'mock_objects', 'simpletest'.DS.'web_tester')); - require_once(LIB_TESTS . 'cake_web_test_case.php'); - require_once(LIB_TESTS . 'cake_test_case.php'); + require_once(CAKE_TESTS_LIB . 'cake_web_test_case.php'); + require_once(CAKE_TESTS_LIB . 'cake_test_case.php'); } function runAllTests(&$reporter) { $manager =& new TestManager(); - if (!empty($manager->usersAppTest)) { - $testCasePath = APP_TEST_CASES; - } else { - $testCasePath = CORE_TEST_CASES; - } - $testCases =& $manager->_getTestFileList($testCasePath); - $test =& new GroupTest('All Core Tests'); + $testCases =& $manager->_getTestFileList($manager->_getTestsPath()); - if (isset($_GET['app'])) { + if ($manager->appTest) { $test =& new GroupTest('All App Tests'); + } else if ($manager->pluginTest) { + $test =& new GroupTest('All ' . Inflector::humanize($manager->pluginTest) . ' Plugin Tests'); } else { $test =& new GroupTest('All Core Tests'); } @@ -80,11 +80,7 @@ class TestManager { function runTestCase($testCaseFile, &$reporter) { $manager =& new TestManager(); - if (!empty($manager->usersAppTest)) { - $testCaseFileWithPath = APP_TEST_CASES . DIRECTORY_SEPARATOR . $testCaseFile; - } else { - $testCaseFileWithPath = CORE_TEST_CASES . DIRECTORY_SEPARATOR . $testCaseFile; - } + $testCaseFileWithPath = $manager->_getTestsPath() . DS . $testCaseFile; if (! file_exists($testCaseFileWithPath)) { trigger_error("Test case {$testCaseFile} cannot be found", E_USER_ERROR); } @@ -93,10 +89,9 @@ class TestManager { return $test->run($reporter); } - function runGroupTest($groupTestName, $groupTestDirectory, &$reporter) { + function runGroupTest($groupTestName, &$reporter) { $manager =& new TestManager(); - $filePath = $groupTestDirectory . DIRECTORY_SEPARATOR . - strtolower($groupTestName) . $manager->_groupExtension; + $filePath = $manager->_getTestsPath('groups') . DS . strtolower($groupTestName) . $manager->_groupExtension; if (! file_exists($filePath)) { trigger_error("Group test {$groupTestName} cannot be found at {$filePath}", E_USER_ERROR); @@ -127,9 +122,9 @@ class TestManager { $groupTest->addTestFile($file.'.test.php'); } - function &getTestCaseList($directory = '.') { + function &getTestCaseList() { $manager =& new TestManager(); - $return = $manager->_getTestCaseList($directory); + $return = $manager->_getTestCaseList($manager->_getTestsPath()); return $return; } @@ -147,9 +142,9 @@ class TestManager { return $return; } - function &getGroupTestList($directory = '.') { + function &getGroupTestList() { $manager =& new TestManager(); - $return = $manager->_getTestGroupList($directory); + $return = $manager->_getTestGroupList($manager->_getTestsPath('groups')); return $return; } @@ -181,12 +176,15 @@ class TestManager { } function &_getRecursiveFileList($directory = '.', $fileTestFunction) { + $fileList = array(); + if (!is_dir($directory)) { + return $fileList; + } $dh = opendir($directory); if (! is_resource($dh)) { trigger_error("Couldn't open {$directory}", E_USER_ERROR); } - $fileList = array(); while ($file = readdir($dh)) { $filePath = $directory . DIRECTORY_SEPARATOR . $file; if (0 === strpos($file, '.')) { @@ -215,6 +213,26 @@ class TestManager { function _hasExpectedExtension($file, $extension) { return $extension == strtolower(substr($file, (0 - strlen($extension)))); } + + function _getTestsPath($type = 'cases') { + if (!empty($this->appTest)) { + if ($type == 'cases') { + $result = APP_TEST_CASES; + } else if ($type == 'groups') { + $result = APP_TEST_GROUPS; + } + } else if (!empty($this->pluginTest)) { + $_pluginBasePath = APP . 'plugins' . DS . $this->pluginTest . DS . 'tests'; + $result = $_pluginBasePath . DS . $type; + } else { + if ($type == 'cases') { + $result = CORE_TEST_CASES; + } else if ($type == 'groups') { + $result = CORE_TEST_GROUPS; + } + } + return $result; + } } /** * Short description for class. @@ -224,9 +242,9 @@ class TestManager { */ class CliTestManager extends TestManager { - function &getGroupTestList($directory = '.') { + function &getGroupTestList() { $manager =& new CliTestManager(); - $groupTests =& $manager->_getTestGroupList($directory); + $groupTests =& $manager->_getTestGroupList($manager->_getTestsPath('groups')); $buffer = "Available Group Test:\n"; foreach ($groupTests as $groupTest) { @@ -235,9 +253,9 @@ class CliTestManager extends TestManager { return $buffer . "\n"; } - function &getTestCaseList($directory = '.') { + function &getTestCaseList() { $manager =& new CliTestManager(); - $testCases =& $manager->_getTestCaseList($directory); + $testCases =& $manager->_getTestCaseList($manager->_getTestsPath()); $buffer = "Available Test Cases:\n"; foreach ($testCases as $testCaseFile => $testCase) { @@ -256,6 +274,7 @@ class TextTestManager extends TestManager { var $_url; function TextTestManager() { + parent::TestManager(); $this->_url = $_SERVER['PHP_SELF']; } @@ -263,33 +282,54 @@ class TextTestManager extends TestManager { return $this->_url; } - function &getGroupTestList($directory = '.') { + function &getGroupTestList() { $manager =& new TextTestManager(); - $groupTests =& $manager->_getTestGroupList($directory); + $groupTests =& $manager->_getTestGroupList($manager->_getTestsPath('groups')); - $buffer = "Available test groups:\n"; - $buffer .= $manager->getBaseURL() . "?group=all All tests<\n"; + $buffer = "Core Test Groups:\n"; + $urlExtra = null; + if ($manager->appTest) { + $buffer = "App Test Groups:\n"; + $urlExtra = '&app=true'; + } else if ($manager->pluginTest) { + $buffer = Inflector::humanize($manager->pluginTest) . " Test Groups:\n"; + $urlExtra = '&plugin=' . $manager->pluginTest; + } + + $buffer .= "All tests\n" . $_SERVER['SERVER_NAME'] . $manager->getBaseURL() . "?group=all&output=txt{$urlExtra}\n"; foreach ((array)$groupTests as $groupTest) { - $buffer .= "
  • " . $groupTest . "&output=txt"."
  • \n"; + $buffer .= $_SERVER['SERVER_NAME']. $manager->getBaseURL()."?group=" . $groupTest . "&output=txt{$urlExtra}"."\n"; } - return $buffer . "\n"; + + return $buffer; } - function &getTestCaseList($directory = '.') { + function &getTestCaseList() { $manager =& new TextTestManager(); - $testCases =& $manager->_getTestCaseList($directory); + $testCases =& $manager->_getTestCaseList($manager->_getTestsPath()); + + $buffer = "Core Test Cases:\n"; + $urlExtra = null; + if ($manager->appTest) { + $buffer = "App Test Cases:\n"; + $urlExtra = '&app=true'; + } else if ($manager->pluginTest) { + $buffer = Inflector::humanize($manager->pluginTest) . " Test Cases:\n"; + $urlExtra = '&plugin=' . $manager->pluginTest; + } if (1 > count($testCases)) { - $noTestCases = "No test cases set up!"; - return $noTestCases; + $buffer .= "EMPTY"; + return $buffer; } - $buffer = "Available test cases:\n"; foreach ($testCases as $testCaseFile => $testCase) { $buffer .= $_SERVER['SERVER_NAME']. $manager->getBaseURL()."?case=" . $testCase . "&output=txt"."\n"; } - return $buffer . "\n"; + + $buffer .= "\n"; + return $buffer; } } /** @@ -302,6 +342,7 @@ class HtmlTestManager extends TestManager { var $_url; function HtmlTestManager() { + parent::TestManager(); $this->_url = $_SERVER['PHP_SELF']; } @@ -309,50 +350,163 @@ class HtmlTestManager extends TestManager { return $this->_url; } - function &getGroupTestList($directory = '.') { - $userApp = ''; - if (isset($_GET['app'])) { - $userApp = '&app=true'; - } + function &getGroupTestList() { + $urlExtra = ''; $manager =& new HtmlTestManager(); - $groupTests =& $manager->_getTestGroupList($directory); + $groupTests =& $manager->_getTestGroupList($manager->_getTestsPath('groups')); - if (isset($_GET['app'])) { - $buffer = "

    Available App Test Groups:

    \n