7.x-2.x branch
Ensure that 2.x style tests are removed when core API is being used.
| Name | Description |
|---|---|
| simpletest_monitor_registry_files_alter | Implement hook_registry_files_alter(). |
- <?php
-
- /**
- * @file
- * Ensure that 2.x style tests are removed when core API is being used.
- */
-
- /**
- * Implement hook_registry_files_alter().
- */
- function simpletest_monitor_registry_files_alter(&$files, $modules) {
- // Determine what the active SimpleTest API version currently is.
- $api = FALSE;
- foreach ($modules as $module) {
- if ($module->name == 'simpletest') {
- $api = substr($module->dir, 0, 7) == 'modules' ? 1 : 2;
- break;
- }
- }
-
- if ($api == 1) {
- // Remove 2.x compatible test files.
- foreach ($modules as $module) {
- if (!empty($module->info['files'])) {
- if (!empty($module->info['testing_api']) && $module->info['testing_api'] == '2.x') {
- $dir = $module->dir;
- foreach ($module->info['files'] as $file) {
- if (substr($file, -5) == '.test') {
- unset($files["$dir/$file"]);
- }
- }
- }
- }
- }
- }
- }
-