private function run() { $start = microtime(true); foreach ($this->Tests as $test) { if (class_exists('\\codespy\\Analyzer')) { \codespy\Analyzer::$currenttest = $test->getTestName(); } $result = $test->run(); if (class_exists('\\codespy\\Analyzer')) { \codespy\Analyzer::$currenttest = ''; } if ($result) { $message = $test->getTestName() . ' - ' . $this->Text->Passed; $this->Results[] = new TestMessage($message, $test, true); } else { $message = '[' . str_replace('{0}', $test->getLine(), str_replace('{1}', $test->getFile(), $this->Text->LineFile)) . '] ' . $test->getTestName() . ' - ' . $this->Text->Failed . ' - ' . $test->getMessage(); $this->Errors[] = new TestMessage($message, $test, false); } } $this->Duration = microtime(true) - $start; }
} else { //setup the Rogo config object $root = str_replace('/testing', '/', str_replace('\\', '/', dirname(__FILE__))); require_once $root . 'classes/configobject.class.php'; $configObject = Config::get_instance(); $cfg_web_root = $configObject->get('cfg_web_root'); require_once $cfg_web_root . 'classes/lang.class.php'; $language = LangUtils::getLang($cfg_web_root); //load the mysqli mocking classes require_once './include/mockmysqli.class.php'; // Include the test framework require_once './include/EnhanceTestFramework.php'; require_once './include/codespy.php'; \codespy\Analyzer::$outputdir = $cfg_web_root . 'testing/coverage'; \codespy\Analyzer::$outputformat = 'html'; \codespy\Analyzer::$coveredcolor = '#c2ffc2'; $run = false; switch ($_GET['test']) { case 'all': \Enhance\Core::discoverTests('./unit_tests/'); \Enhance\Core::discoverTests('../plugins/'); $run = TRUE; break; case 'one': $path = './unit_tests/' . $_GET['one']; if (is_file($path) and stristr($path, 'unit_tests') !== FALSE) { \Enhance\Core::discoverTests($path); $run = TRUE; } break; case 'questions':