diff options
Diffstat (limited to 'modules/system')
-rw-r--r-- | modules/system/system.api.php | 53 | ||||
-rw-r--r-- | modules/system/system.info | 1 |
2 files changed, 54 insertions, 0 deletions
diff --git a/modules/system/system.api.php b/modules/system/system.api.php index 0efcedbc3..1349a7b8f 100644 --- a/modules/system/system.api.php +++ b/modules/system/system.api.php @@ -1701,5 +1701,58 @@ function hook_disable() { } /** + * Perform necessary alterations to the list of files parsed by the registry. + * + * Modules can manually modify the list of files before the registry parses + * them. The $modules array provides the .info file information, which includes + * the list of files registered to each module. Any files in the list can then + * be added to the list of files that the registry will parse, or modify + * attributes of a file. + * + * A necessary alteration made by the core SimpleTest module is to force .test + * files provided by disabled modules into the list of files parsed by the + * registry. + * + * @param $files + * List of files to be parsed by the registry. The list will contain + * files found in each enabled module's info file and the core includes + * directory. The array is keyed by the file path and contains an array of + * the related module's name and weight as used internally by + * _registry_rebuild() and related functions. + * + * For example: + * @code + * $files["modules/system/system.module"] = array( + * 'module' => 'system', + * 'weight' => 0, + * ); + * @endcode + * @param $modules + * List of all the modules provided as returned by drupal_system_listing(). + * The list also contains the .info file information in the property 'info'. + * An additional 'dir' property has been added to the module information + * which provides the path to the directory in which the module resides. The + * example shows how to take advantage of the property both properties. + * + * @see _registry_rebuild() + * @see drupal_system_listing() + * @see simpletest_test_get_all() + */ +function hook_registry_files_alter(&$files, $module_cache) { + foreach ($modules as $module) { + // Only add test files for disabled modules, as enabled modules should + // already include any test files they provide. + if (!$module->status) { + $dir = $module->dir; + foreach ($module->info['files'] as $file) { + if (substr($file, -5) == '.test') { + $files["$dir/$file"] = array('module' => $module->name, 'weight' => $module->weight); + } + } + } + } +} + +/** * @} End of "addtogroup hooks". */ diff --git a/modules/system/system.info b/modules/system/system.info index 0afcdaf9a..9c93a0960 100644 --- a/modules/system/system.info +++ b/modules/system/system.info @@ -9,4 +9,5 @@ files[] = system.admin.inc files[] = system.queue.inc files[] = image.gd.inc files[] = system.install +files[] = system.test required = TRUE |