Index: modules/simpletest/simpletest.module =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.module,v retrieving revision 1.5 diff -u -r1.5 simpletest.module --- modules/simpletest/simpletest.module 26 Jun 2008 21:07:59 -0000 1.5 +++ modules/simpletest/simpletest.module 30 Jun 2008 16:11:51 -0000 @@ -27,6 +27,14 @@ 'description' => 'Run tests against Drupal core and your active modules. These tests help assure that your site code is working as designed.', 'access arguments' => array('administer unit tests'), ); + $items['admin/build/testing/run'] = array( + 'title' => 'Testing', + 'page callback' => 'simpletest_run_tests_web', + 'page arguments' => array(4), + 'description' => 'Run a single test given a test case name.', + 'access arguments' => array('administer unit tests'), + 'type' => MENU_CALLBACK, + ); $items['admin/settings/testing'] = array( 'title' => 'Testing', 'description' => 'Configure SimpleTest framework.', @@ -564,6 +572,32 @@ rmdir($path); } +/** + * Run a the specified tests given their test case names and output + * the results using the standard web interface. + * + * @param string $test_cases Comma delimited list of test cases or 'all'. + * @return HTML output. + */ +function simpletest_run_tests_web($test_cases) { + if ($test_cases == 'all') { + $test_cases = array_keys(simpletest_get_all_tests()); + } + else { + $test_cases = explode(',', $test_cases); + } + + $form_state = array(); + foreach ($test_cases as $case) { + $form_state['values'][$case] = 1; + } + $form_state['op'] = t('Run selected tests'); + + drupal_execute('simpletest_test_form', $form_state); + + return drupal_get_form('simpletest_test_form'); +} + function simpletest_settings() { $form = array();