function DrupalUnitTests::drupalModuleEnable in SimpleTest 6
Same name and namespace in other branches
- 5 drupal_unit_tests.php \DrupalUnitTests::drupalModuleEnable()
Enables a drupal module
Parameters
string $name name of the module:
Return value
boolean success
File
- ./
drupal_unit_tests.php, line 135
Class
Code
function drupalModuleEnable($name) {
if (module_exists($name)) {
return TRUE;
}
include_once './includes/install.inc';
module_rebuild_cache();
// Rebuild the module cache
if (drupal_get_installed_schema_version($name, TRUE) == SCHEMA_UNINSTALLED) {
drupal_install_modules(array(
$name,
));
}
else {
$try = module_enable(array(
$name,
));
}
if (module_exists($name)) {
if (!isset($this->_cleanupModules[$name])) {
$this->_cleanupModules[$name] = 0;
return TRUE;
}
}
else {
die("required module {$name} could not be enabled (probably file does not exist)");
}
}