You are here

function simpletest_entrypoint in SimpleTest 6

Same name and namespace in other branches
  1. 5 simpletest.module \simpletest_entrypoint()

Menu callback for both running tests and listing possible tests

1 string reference to 'simpletest_entrypoint'
simpletest_menu in ./simpletest.module
Implementation of hook_menu().

File

./simpletest.module, line 70

Code

function simpletest_entrypoint() {
  global $simpletest_ua_key;
  simpletest_load();
  if (!$simpletest_ua_key) {
    $output = t('Please add the following code to the bottom of settings.php');
    $output .= '<p><code><pre>$GLOBALS["simpletest_ua_key"] = ' . mt_rand(1000, 1000000) . ';
if (preg_match("/^(simpletest\\d+),(\\d+)/", $_SERVER["HTTP_USER_AGENT"], $matches) && $GLOBALS["simpletest_ua_key"] == $matches[2]) {
  $db_prefix = $matches[1];
}</pre></code></p>';
    return $output;
  }
  drupal_add_js(SIMPLETEST_MODULE_PATH . '/simpletest.js', 'module');
  $output = drupal_get_form('simpletest_overview_form');
  if (simpletest_running_output()) {
    return simpletest_running_output() . $output;
  }
  else {
    return $output;
  }
}