You are here

function simpletest_run_tests in SimpleTest 6

Same name and namespace in other branches
  1. 8.3 simpletest.module \simpletest_run_tests()
  2. 5 simpletest.module \simpletest_run_tests()
  3. 6.2 simpletest.module \simpletest_run_tests()
  4. 7.2 simpletest.module \simpletest_run_tests()
  5. 7 simpletest.module \simpletest_run_tests()

Actually runs tests

Parameters

array $testlist list of tests to run or DEFAULT NULL run all tests:

boolean $html_reporter true if you want results in simple html, FALSE for full drupal page:

2 calls to simpletest_run_tests()
run_all_tests.php in ./run_all_tests.php
simpletest_overview_form_submit in ./simpletest.module
FAPI form submit for simpletest_overview_form

File

./simpletest.module, line 315

Code

function simpletest_run_tests($testlist = NULL, $reporter = 'drupal') {
  global $test_running;
  if (!$test_running) {
    $test_running = TRUE;
    $test = simpletest_get_total_test($testlist);
    switch ($reporter) {
      case 'text':
        $reporter =& new TextReporter();
        break;
      case 'xml':
        $reporter =& new XMLReporter();
        break;
      case 'html':
        $reporter =& new HtmlReporter();
        break;
      case 'drupal':
        $reporter =& new DrupalReporter();
        break;
    }
    cache_clear_all();
    $results = $test
      ->run($reporter);
    $test_running = FALSE;
    switch (get_class($reporter)) {
      case 'TextReporter':
      case 'XMLReporter':
      case 'HtmlReporter':
        return $results;
      case 'DrupalReporter':
        return $reporter
          ->getOutput();
    }
  }
}