$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(); } else {
include CAKE_TESTS_LIB . 'xdebug.php'; CakePHPTestSuiteFooter(); exit; } } CakePHPTestHeader(); CakePHPTestSuiteHeader(); define('RUN_TEST_LINK', $_SERVER['PHP_SELF']); if (isset($_GET['group'])) { if ('all' == $_GET['group']) { TestManager::runAllTests(CakeTestsGetReporter()); } else { if ($analyzeCodeCoverage) { CodeCoverageManager::start($_GET['group'], CakeTestsGetReporter()); } TestManager::runGroupTest(ucfirst($_GET['group']), CakeTestsGetReporter()); if ($analyzeCodeCoverage) { CodeCoverageManager::report(); } } CakePHPTestRunMore(); CakePHPTestAnalyzeCodeCoverage(); } elseif (isset($_GET['case'])) { if ($analyzeCodeCoverage) { CodeCoverageManager::start($_GET['case'], CakeTestsGetReporter()); } TestManager::runTestCase($_GET['case'], CakeTestsGetReporter()); if ($analyzeCodeCoverage) { CodeCoverageManager::report(); } CakePHPTestRunMore();
***********************************************************************************/ ob_start(); require_once LIMB_DIR . '/tests/lib/test_utils.php'; require_once LIMB_DIR . '/tests/lib/test_manager.php'; if (!(include_once SIMPLE_TEST . 'reporter.php')) { error('runtime', 'LIBRARY_REQUIRED', array('library' => 'Simple Test', 'path' => SIMPLE_TEST)); } if (isset($_GET['all'])) { TestManager::runAllTests($_GET['all'], new HTMLReporter()); echo "<p><a href='" . $_SERVER['PHP_SELF'] . "'>Run more tests</a></p>"; echo debug::parse_html_console(); ob_end_flush(); exit(0); } if (isset($_GET['group'])) { TestManager::runGroupTest(ucfirst($_GET['group']), $_GET['group'], new HTMLReporter()); echo "<p><a href='" . $_SERVER['PHP_SELF'] . "'>Run more tests</a></p>"; echo debug::parse_html_console(); ob_end_flush(); exit(0); } if (isset($_GET['case'])) { TestManager::runTestCase($_GET['case'], new HTMLReporter()); echo "<p><a href='" . $_SERVER['PHP_SELF'] . "?show=cases'>Run more tests</a></p>"; echo debug::parse_html_console(); ob_end_flush(); exit(0); } echo "<h1>Unit Test Suite</h1>\n"; echo "<p><a href='" . $_SERVER['PHP_SELF'] . "'>Test groups</a>"; echo " || <a href='" . $_SERVER['PHP_SELF'] . "?show=cases'>Test cases</a></p>";
/** * Executes the tests depending on our settings * * @return void * @access private */ function __run() { $reporter = new CLIReporter(); $this->__setGetVars(); if ($this->type == 'all') { return TestManager::runAllTests($reporter); } if ($this->doCoverage) { if (!extension_loaded('xdebug')) { $this->out('You must install Xdebug to use the CakePHP(tm) Code Coverage Analyzation. Download it from http://www.xdebug.org/docs/install'); exit(0); } } if ($this->type == 'group') { $ucFirstGroup = ucfirst($this->file); $path = CORE_TEST_GROUPS; if ($this->category == 'app') { $path = APP_TEST_GROUPS; } elseif ($this->isPluginTest) { $path = APP . 'plugins' . DS . $this->category . DS . 'tests' . DS . 'groups'; } if ($this->doCoverage) { require_once CAKE . 'tests' . DS . 'lib' . DS . 'code_coverage_manager.php'; CodeCoverageManager::start($ucFirstGroup, $reporter); } $result = TestManager::runGroupTest($ucFirstGroup, $reporter); if ($this->doCoverage) { CodeCoverageManager::report(); } return $result; } $case = 'libs' . DS . $this->file . '.test.php'; if ($this->category == 'app') { $case = $this->file . '.test.php'; } elseif ($this->isPluginTest) { $case = $this->file . '.test.php'; } if ($this->doCoverage) { require_once CAKE . 'tests' . DS . 'lib' . DS . 'code_coverage_manager.php'; CodeCoverageManager::start($case, $reporter); } $result = TestManager::runTestCase($case, $reporter); if ($this->doCoverage) { CodeCoverageManager::report(); } return $result; }
/** * Executes the tests depending on $testToRun */ function _runTest() { // Need to set some get variables as TestManager depends on them if (in_array($this->testToRun['section'], $this->plugins)) { $_GET['plugin'] = $this->testToRun['section']; } elseif (in_array(Inflector::Humanize($this->testToRun['section']), $this->plugins)) { $_GET['plugin'] = Inflector::Humanize($this->testToRun['section']); } elseif ($this->testToRun['section'] == 'app') { $_GET['app'] = true; } if ($this->testToRun['area'] == 'all') { TestManager::runAllTests(new TextReporter()); return; } elseif ($this->testToRun['area'] == 'group') { $_GET['group'] == $this->testToRun['file']; if (isset($_GET['app'])) { TestManager::runGroupTest(ucfirst($_GET['group']), APP_TEST_GROUPS, new TextReporter()); } elseif (isset($_GET['plugin'])) { TestManager::runGroupTest(ucfirst($_GET['group']), APP . 'plugins' . DS . $_GET['plugin'] . DS . 'tests' . DS . 'groups', new TextReporter()); } else { TestManager::runGroupTest(ucfirst($_GET['group']), CORE_TEST_GROUPS, new TextReporter()); } return; } else { $_GET['case'] = 'cases' . DS . $this->testToRun['type'] . DS . $this->testToRun['file'] . '.test.php'; TestManager::runTestCase($_GET['case'], new TextReporter()); return; } }
/** * Short Description * * @license http://www.opensource.org/licenses/mit-license.php The MIT License * @copyright Copyright 2008-2009, Spaghetti* Framework (http://spaghettiphp.org/) * */ if (version_compare(PHP_VERSION, "5.3") >= 0) { ini_set("error_reporting", E_ALL & ~E_DEPRECATED); } else { ini_set("error_reporting", E_ALL); } define("DS", DIRECTORY_SEPARATOR); define("ROOT", dirname(dirname(dirname(__FILE__)))); define("BASE_URL", "http://" . $_SERVER["HTTP_HOST"]); define("CORE", ROOT . DS . "core"); define("LIB", CORE . DS . "lib"); define("APP", ROOT . DS . "app"); $self = dirname($_SERVER["PHP_SELF"]); while (in_array(basename($self), array("app", "core", "tests", "webroot"))) { $self = dirname($self); } define("WEBROOT", $self); include "../../core/bootstrap.php"; App::import("Core", "test_manager"); TestManager::loadTestFramework(); if (isset($_GET["case"])) { TestManager::runTestCase($_GET["case"]); } elseif (isset($_GET["group"])) { TestManager::runGroupTest($_GET["group"]); }
} break; } } } if (!@(include_once SIMPLE_TEST . 'runner.php')) { error('runtime', 'LIBRARY_REQUIRED', array('library' => 'Simple Test', 'path' => SIMPLE_TEST)); } require_once LIMB_DIR . '/tests/lib/cli_reporter.php'; /* list grouptests */ if ($opt_list) { echo CLITestManager::getGroupTestList(TEST_GROUPS_DIR); echo CLITestManager::getTestCaseList(TEST_CASES_DIR); exit(0); } /* run a test case */ if ($opt_casefile) { TestManager::runTestCase($opt_casefile, new CLIReporter($opt_separator)); echo debug::parse_cli_console(); exit(0); } /* run a grouptest */ if ($opt_groupfile) { TestManager::runGroupTest($opt_groupfile, TEST_GROUPS_DIR, new CLIReporter($opt_separator)); echo debug::parse_cli_console(); exit(0); } /* run all tests */ TestManager::runAllTests(new CLIReporter($opt_separator)); echo debug::parse_cli_console(); exit(0);
default: $footer = <<<EOD </body> </html> EOD; echo $footer; break; } } /** OUTPUT STARTS HERE **/ // If it's a group test if (isset($_GET['group'])) { if ('all' == $_GET['group']) { TestManager::runAllTests(DW_TESTS_GetReporter()); } else { TestManager::runGroupTest(ucfirst($_GET['group']), TEST_GROUPS, DW_TESTS_GetReporter()); } DW_TESTS_PaintRunMore(); exit; } // If it's a single test case if (isset($_GET['case'])) { TestManager::runTestCase($_GET['case'], TEST_CASES, DW_TESTS_GetReporter()); DW_TESTS_PaintRunMore(); exit; } // Else it's the main page DW_TESTS_PaintHeader(); DW_TESTS_PaintSuiteHeader(); if (isset($_GET['show']) && $_GET['show'] == 'cases') { DW_TESTS_PaintCaseList();
// If it's a group test if (isset($_GET['group'])) { if ('all' == $_GET['group']) { TestManager::runAllTests(DW_TESTS_GetReporter()); } else { TestManager::runGroupTest(ucfirst($_GET['group']), TEST_GROUPS, DW_TESTS_GetReporter()); } DW_TESTS_PaintRunMore(); exit; } // If it's a plugin group test if (isset($_GET['plugin_group'])) { if ('all' == $_GET['plugin_group']) { TestManager::runAllPluginTests(DW_TESTS_GetReporter()); } else { TestManager::runGroupTest(ucfirst($_GET['plugin_group']), TEST_PLUGINS, DW_TESTS_GetReporter()); } DW_TESTS_PaintRunMore(); exit; } // If it's a single test case if (isset($_GET['case'])) { TestManager::runTestCase($_GET['case'], TEST_CASES, DW_TESTS_GetReporter()); DW_TESTS_PaintRunMore(); exit; } // If it's a single plugin test case if (isset($_GET['plugin_case'])) { TestManager::runTestCase($_GET['plugin_case'], TEST_PLUGINS, DW_TESTS_GetReporter()); DW_TESTS_PaintRunMore(); exit;
} /* run a test case */ if ($opt_casefile) { TestManager::runTestFile($opt_casefile, new CLIReporter($opt_separator)); exit(0); } /* run a test case by id */ if ($opt_caseid) { TestManager::runTestCase($opt_caseid, TEST_CASES, new CLIReporter($opt_separator)); exit(0); } /* run a plugin test by case id */ if ($opt_plugincaseid) { TestManager::runTestCase($opt_plugincaseid, TEST_PLUGINS, new CLIReporter($opt_separator)); exit(0); } /* run a grouptest */ if ($opt_groupfile) { TestManager::runGroupTest($opt_groupfile, TEST_GROUPS, new CLIReporter($opt_separator)); exit(0); } /* run a plugin grouptest */ if ($opt_plugingroupfile) { TestManager::runGroupTest($opt_plugingroupfile, TEST_PLUGINS, new CLIReporter($opt_separator)); exit(0); } /* run a plugin group test */ //FIXME /* run all tests */ TestManager::runAllTests(new CLIReporter($opt_separator)); exit(0);