Skip to content

Instantly share code, notes, and snippets.

@jec006
Created July 19, 2012 19:04
Show Gist options
  • Save jec006/3146043 to your computer and use it in GitHub Desktop.
Save jec006/3146043 to your computer and use it in GitHub Desktop.
'Enable' a module during unit tests
<?php
/**
* Fake enables a module for the purpose of a unit test
*
* @param $name
* The module's machine name (i.e. ctools not Chaos Tools)
*/
protected function enableModule($name) {
$modules = module_list();
$modules[$name] = $name;
module_list(TRUE, FALSE, FALSE, $modules);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment