summaryrefslogtreecommitdiff
path: root/test/runtests.php
diff options
context:
space:
mode:
authorhfuecks <hfuecks@gmail.com>2005-10-12 10:10:13 +0200
committerhfuecks <hfuecks@gmail.com>2005-10-12 10:10:13 +0200
commitcbf6ced732cfa27bdf7d492604696e01d7657da9 (patch)
treeb6e342ba944e5adea69dfadba82fff3ea183f770 /test/runtests.php
parent6222040c35d547dc99f13bd2bb8222165aa4ce2c (diff)
downloadrpg-cbf6ced732cfa27bdf7d492604696e01d7657da9.tar.gz
rpg-cbf6ced732cfa27bdf7d492604696e01d7657da9.tar.bz2
test_suite_tuning
darcs-hash:20051012081013-e96b6-df581e5b94bb5e5ea1ed8693e754fd5877fbd164.gz
Diffstat (limited to 'test/runtests.php')
-rwxr-xr-xtest/runtests.php51
1 files changed, 35 insertions, 16 deletions
diff --git a/test/runtests.php b/test/runtests.php
index 5e9bea983..ba9bc4b1d 100755
--- a/test/runtests.php
+++ b/test/runtests.php
@@ -1,11 +1,6 @@
#!/usr/bin/php -q
<?php
-/**
-* TODO: This needs migrating to inc/cli_opts.php
-*/
-
ini_set('memory_limit','128M');
-/* wact common */
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
define('TEST_ROOT', dirname(__FILE__));
define('TMPL_FILESCHEME_PATH', TEST_ROOT . '/filescheme/');
@@ -21,10 +16,12 @@ Run the Dokuwiki unit tests. If ALL of the test cases pass a count of total
passes is printed on STDOUT. If ANY of the test cases fail (or raise
errors) details are printed on STDERR and this script returns a non-zero
exit code.
- -f --file=NAME specify a test case file
+ -c --case=NAME specify a test case by it's ID (see -i for list)
+ -f --file=NAME specify a test case file (full or relative path)
-g --group=NAME specify a grouptest. If no grouptest is
specified, all test cases will be run.
- -l --list list available grouptests/test case files
+ -i --caselist list individual test cases by their ID
+ -l --grouplist list available grouptests
-s, --separator=SEP set the character(s) used to separate fail
details to SEP
-p, --path path to SimpleTest installation
@@ -37,15 +34,16 @@ EOD;
/* test options */
$opt_separator = '->';
-$opt_list = FALSE;
+$opt_caselist = FALSE;
+$opt_grouplist = FALSE;
+$opt_caseid = 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=");
+$short_opts = "c:f:g:hils:p:";
+$long_opts = array("case=","caselist","help", "file=", "group=", "grouplist", "separator=", "path=");
$OPTS = Doku_Cli_Opts::getOptions(__FILE__,$short_opts,$long_opts);
if ( $OPTS->isError() ) {
fwrite( STDERR, $OPTS->getMessage() . "\n");
@@ -55,6 +53,10 @@ if ( $OPTS->isError() ) {
foreach ($OPTS->options as $key => $val) {
switch ($key) {
+ case 'c':
+ case 'case':
+ $opt_caseid = $val;
+ break;
case 'h':
case 'help':
usage();
@@ -67,9 +69,13 @@ foreach ($OPTS->options as $key => $val) {
case 'group':
$opt_groupfile = $val;
break;
+ case 'i':
+ case 'caselist':
+ $opt_caselist = TRUE;
+ break;
case 'l':
- case 'list':
- $opt_list = TRUE;
+ case 'grouplist':
+ $opt_grouplist = TRUE;
break;
case 's':
case 'separator':
@@ -84,7 +90,6 @@ foreach ($OPTS->options as $key => $val) {
}
}
-
if (!@include_once SIMPLE_TEST . 'reporter.php') {
die("Where's Simple Test ?!? Not at ".SIMPLE_TEST);
}
@@ -92,14 +97,28 @@ if (!@include_once SIMPLE_TEST . 'reporter.php') {
require_once 'lib/cli_reporter.php';
/* list grouptests */
-if ($opt_list) {
+if ($opt_grouplist) {
echo CLITestManager::getGroupTestList(TEST_GROUPS);
+}
+
+/* list test cases */
+if ($opt_caselist) {
echo CLITestManager::getTestCaseList(TEST_CASES);
+}
+
+/* exit if we've displayed a list */
+if ( $opt_grouplist || $opt_caselist ) {
exit(0);
}
+
/* run a test case */
if ($opt_casefile) {
- TestManager::runTestCase($opt_casefile, new CLIReporter($opt_separator));
+ 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 grouptest */