Skip to content

Commit

Permalink
- Patch #254166 by boombatower and pwlonin: added --list feature to l…
Browse files Browse the repository at this point in the history
…ist all available test groups and fixed some indentation issues.
  • Loading branch information
dries committed May 28, 2008
1 parent 810ee68 commit 560ce40
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions scripts/run-functional-tests.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/php
<?php
// $Id: run-functional-tests.sh,v 1.2 2008-05-26 19:43:46 dries Exp $
// $Id: run-functional-tests.sh,v 1.3 2008-05-28 12:35:32 dries Exp $

/**
* @file
Expand All @@ -27,20 +27,22 @@ Example: {$script} Profile
All arguments are long options.
--help Print this page.
--list Display all available test groups.
--clean Cleans up database tables or directories from previous, failed,
tests and then exits (no tests are run).
--url Immediately preceeds a URL to set the host and path. You will
need this parameter if Drupal is in a subdirectory on your
--url Immediately preceeds a URL to set the host and path. You will
need this parameter if Drupal is in a subdirectory on your
localhost and you have not set \$base_url in settings.php.
--reporter Immediatly preceeds the name of the output reporter to use. This
--reporter Immediatly preceeds the name of the output reporter to use. This
Defaults to "text", while other options include "xml" and "html".
--all Run all available tests.
--all Run all available tests.
--class Run tests identified by speficic class names.
--class Run tests identified by speficic class names.
<test1>[,<test2>[,<test3> ...]]
Expand All @@ -52,7 +54,7 @@ All arguments are long options.
specific test classes whose test methods will be run. Tests must
be separated by commas. Ignored if --all is specified.
To run this script you will normally invoke it from the root directory of your
To run this script you will normally invoke it from the root directory of your
Drupal installation as
php ./scripts/{$script}
Expand All @@ -61,13 +63,17 @@ EOF;
exit;
}

$list = FALSE;
$clean = FALSE;
$all = FALSE;
$class_names = FALSE;
$test_names = array();

while ($param = array_shift($_SERVER['argv'])) {
switch ($param) {
case '--list':
$list = TRUE;
break;
case '--url':
$url = array_shift($_SERVER['argv']);
$parsed = parse_url($url);
Expand Down Expand Up @@ -133,6 +139,15 @@ $total_test = &simpletest_get_total_test();

$test_instances = $total_test->getTestInstances();

if ($list) {
// Display all availabe tests.
echo("Available test groups:\n----------------------\n");
foreach ($test_instances as $group_test) {
echo($group_test->getLabel() . "\n");
}
exit;
}

if ($all) {
$test_list = NULL;
}
Expand Down

0 comments on commit 560ce40

Please sign in to comment.