public function run_tests($argv) { error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE); define("ENV", "test"); $this->app_setup(); define("CLI_ENV", true); if (!(include 'simpletest/unit_tester.php') || !(include 'simpletest/mock_objects.php')) { throw new WXDependencyException("Simpletest library required. Install it somewhere in the include path", "Simpletest Dependency Failure"); } if ($argv[1] == "wax") { $testdir = FRAMEWORK_DIR . "/tests"; } elseif ($argv[1] && is_dir(PLUGIN_DIR . $argv[1] . "/tests")) { $testdir = PLUGIN_DIR . $argv[1] . "/tests"; } else { $testdir = APP_DIR . "tests"; } AutoLoader::include_dir($testdir); $test = new GroupTest('All tests'); foreach (scandir($testdir) as $file) { if (substr($file, -3) == "php" && substr($file, 0, 1) != ".") { $class = substr($file, 0, -4); $test->addTestClass($class); } } if (TextReporter::inCli()) { exit($test->run(new TextReporter()) ? 0 : 1); } $test->run(new HtmlReporter()); }