You are here

function DrupalUnitTests::drupalModuleDisable in SimpleTest 6

Same name and namespace in other branches
  1. 5 drupal_unit_tests.php \DrupalUnitTests::drupalModuleDisable()

Disables a drupal module

Parameters

string $name name of the module:

Return value

boolean success

File

./drupal_unit_tests.php, line 165

Class

DrupalUnitTests

Code

function drupalModuleDisable($name) {
  if (!module_exists($name)) {
    return TRUE;
  }

  /* Update table */
  db_query("UPDATE {system} SET status = 0 WHERE name = '%s' AND type = 'module'", $name);
  if (db_affected_rows()) {

    /* Make sure not overwriting when double switching */
    if (!isset($this->_cleanupModules[$name])) {
      $this->_cleanupModules[$name] = 1;
    }

    /* refresh module_list */
    module_list(TRUE, FALSE);
    return TRUE;
  }
  die("incompatible module {$name} could not be disabled for unknown reason");
}