#!/usr/bin/php -q '; $opt_list = FALSE; $opt_casefile = FALSE; $opt_groupfile = FALSE; /* only allow cmd line options if PEAR Console_Getopt is available */ include_once(DOKU_INC.'inc/cliopts.php'); $short_opts = "f:g:hls:p:"; $long_opts = array("help", "file=", "group=", "list", "separator=", "path="); $OPTS = Doku_Cli_Opts::getOptions(__FILE__,$short_opts,$long_opts); if ( $OPTS->isError() ) { fwrite( STDERR, $OPTS->getMessage() . "\n"); usage($available_grouptests); exit(1); } foreach ($OPTS->options as $key => $val) { switch ($key) { case 'h': case 'help': usage(); break; case 'f': case 'file': $opt_casefile = $val; break; case 'g': case 'group': $opt_groupfile = $val; break; case 'l': case 'list': $opt_list = TRUE; break; case 's': case 'separator': $opt_separator = $val; break; case 'p': case 'path': if (file_exists($val)) { define('SIMPLE_TEST', $val); } break; } } if (!@include_once SIMPLE_TEST . 'reporter.php') { die("Where's Simple Test ?!? Not at ".SIMPLE_TEST); } require_once 'lib/cli_reporter.php'; /* list grouptests */ if ($opt_list) { echo CLITestManager::getGroupTestList(TEST_GROUPS); echo CLITestManager::getTestCaseList(TEST_CASES); exit(0); } /* run a test case */ if ($opt_casefile) { TestManager::runTestCase($opt_casefile, 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 all tests */ TestManager::runAllTests(new CLIReporter($opt_separator)); exit(0); ?>