### Eclipse Workspace Patch 1.0 #P simpletest Index: simpletest.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/simpletest.module,v retrieving revision 1.47 diff -u -r1.47 simpletest.module --- simpletest.module 14 Apr 2008 21:56:02 -0000 1.47 +++ simpletest.module 19 Apr 2008 16:19:23 -0000 @@ -26,6 +26,24 @@ '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/simpletest/all'] = array( + 'title' => 'All', + 'page callback' => 'simpletest_entrypoint', + 'access arguments' => array('administer unit tests'), + 'type' => MENU_DEFAULT_LOCAL_TASK + ); + $items['admin/build/simpletest/functional'] = array( + 'title' => 'Functional', + 'page callback' => 'simpletest_entrypoint', + 'access arguments' => array('administer unit tests'), + 'type' => MENU_LOCAL_TASK + ); + $items['admin/build/simpletest/unit'] = array( + 'title' => 'Unit', + 'page callback' => 'simpletest_entrypoint', + 'access arguments' => array('administer unit tests'), + 'type' => MENU_LOCAL_TASK + ); $items['admin/settings/simpletest'] = array( 'title' => 'SimpleTest', 'description' => 'Configure SimpleTest framework.', @@ -86,6 +104,7 @@ $path = drupal_get_path('module', 'simpletest') .'/'; require_once($path .'drupal_test_case.php'); + require_once($path .'drupal_unit_test_case.php'); require_once($path .'drupal_unit_tests.php'); return true; } @@ -253,7 +272,9 @@ } // Output test groups. $output = ''; - $output .= theme('table', $header, $rows, array('id' => 'simpletest-form-table')); + if (count($rows)) { + $output .= theme('table', $header, $rows, array('id' => 'simpletest-form-table')); + } // Output the rest of the form, excluded test groups which have been removed. $output .= drupal_render($form); Index: drupal_unit_tests.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/drupal_unit_tests.php,v retrieving revision 1.17 diff -u -r1.17 drupal_unit_tests.php --- drupal_unit_tests.php 3 Apr 2008 19:57:15 -0000 1.17 +++ drupal_unit_tests.php 19 Apr 2008 16:19:22 -0000 @@ -41,10 +41,24 @@ $files = array(); foreach (module_list() as $module) { $module_path = drupal_get_path('module', $module); - if (file_exists($module_path .'/tests/')) { - $dir = $module_path .'/tests'; - $tests = file_scan_directory($dir, '\.test$'); - $files = array_merge($files, $tests); + if (file_exists($module_path . '/tests/')) { + // Check for functional/unit separation. + $functional = strpos($_GET['q'], 'functional') !== FALSE; + $unit = strpos($_GET['q'], 'unit') !== FALSE; + if (!$functional && !$unit) { + $dir = $module_path . '/tests'; + } + else if ($functional && file_exists($module_path .'/tests/functional')) { + $dir = $module_path . '/tests/functional'; + } + else if ($unit && file_exists($module_path .'/tests/unit')) { + $dir = $module_path . '/tests/unit'; + } + + if (isset($dir)) { + $tests = file_scan_directory($dir, '\.test$'); + $files = array_merge($files, $tests); + } } } $files = array_keys($files);