Commit b87b7c2d authored by Dries's avatar Dries
Browse files

- Patch #265040 by flobruit: Remove drupalModuleEnable() from simpletest.

parent 05769e30
......@@ -12,9 +12,13 @@ class XMLRPCValidator1Test extends DrupalWebTestCase {
'group' => t('XML-RPC')
);
}
function setUp() {
parent::setUp('simpletest_xmlrpc');
}
function test_run_all_tests() {
if (!$this->drupalModuleEnable('simpletest_xmlrpc')) {
if (!module_exists('simpletest_xmlrpc')) {
return FALSE;
}
$xml_url = url(NULL, array('absolute' => TRUE)) . 'xmlrpc.php';
......
......@@ -9,9 +9,8 @@ class ProfileTestCase extends DrupalWebTestCase {
protected $normal_user;
function setUp() {
parent::setUp();
parent::setUp('profile');
variable_set('user_register', 1);
$this->drupalModuleEnable('profile');
$this->admin_user = $this->drupalCreateUser(array('administer users', 'access user profiles'));
......
......@@ -212,15 +212,10 @@ class SearchRankingTestCase extends DrupalWebTestCase {
* Implementation setUp().
*/
function setUp() {
parent::setUp('search');
parent::setUp('search', 'statistics', 'comment');
}
function testRankings() {
// Enable modules that are tested.
$this->drupalModuleEnable('search');
$this->drupalModuleEnable('statistics');
$this->drupalModuleEnable('comment');
// Login with sufficient privileges.
$this->drupalLogin($this->drupalCreateUser(array('post comments without approval', 'create page content')));
......
......@@ -10,7 +10,6 @@ class DrupalWebTestCase extends UnitTestCase {
protected $plain_text;
protected $ch;
protected $elements;
protected $_modules = array();
// We do not reuse the cookies in further runs, so we do not need a file
// but we still need cookie handling, so we set the jar to NULL
protected $cookie_file = NULL;
......@@ -182,57 +181,6 @@ function randomName($number = 4, $prefix = 'simpletest_') {
return $prefix;
}
/**
* Enables a drupal module in the test database. Any module that is not
* part of the required core modules needs to be enabled in order to use
* it in a test.
*
* @param string $name Name of the module to enable.
* @return boolean Success.
*/
function drupalModuleEnable($name) {
if (module_exists($name)) {
return $this->pass(t('@name module already enabled', array('@name' => $name)), t('Module'));
}
$this->_modules[$name] = $name;
$form_state['values'] = array('status' => $this->_modules, 'op' => t('Save configuration'));
drupal_execute('system_modules', $form_state);
//rebuilding all caches
drupal_rebuild_theme_registry();
node_types_rebuild();
menu_rebuild();
cache_clear_all('schema', 'cache');
module_rebuild_cache();
return $this->assertTrue(module_exists($name), t('@name enabled.', array('@name' => $name)), t('Module'));
}
/**
* Disables a drupal module in the test database.
*
* @param string $name Name of the module.
* @return boolean Success.
* @see drupalModuleEnable()
*/
function drupalModuleDisable($name) {
if (!module_exists($name)) {
return $this->pass(t('@name module already disabled', array('@name' => $name)), t('Module'));
}
unset($this->_modules[$key]);
$form_state['values'] = array('status' => $this->_modules, 'op' => t('Save configuration'));
drupal_execute('system_modules', $form_state);
//rebuilding all caches
drupal_rebuild_theme_registry();
node_types_rebuild();
menu_rebuild();
cache_clear_all('schema', 'cache');
module_rebuild_cache();
return $this->assertTrue(!module_exists($name), t('@name disabled.', array('@name' => $name)), t('Module'));
}
/**
* Create a user with a given set of permissions. The permissions correspond to the
* names given on the privileges page.
......@@ -348,12 +296,14 @@ function drupalLogout() {
}
/**
* Generates a random database prefix and runs the install scripts on the prefixed database.
* After installation many caches are flushed and the internal browser is setup so that the page
* requests will run on the new prefix. A temporary files directory is created with the same name
* as the database prefix.
* Generates a random database prefix, runs the install scripts on the
* prefixed database and enable the specified modules. After installation
* many caches are flushed and the internal browser is setup so that the
* page requests will run on the new prefix. A temporary files directory
* is created with the same name as the database prefix.
*
* @param ... List modules to enable.
* @param ...
* List of modules to enable for the duration of the test.
*/
function setUp() {
global $db_prefix;
......@@ -372,11 +322,7 @@ function setUp() {
$modules = array_unique(array_merge(drupal_verify_profile('default', 'en'), $args));
drupal_install_modules($modules);
// Store the list of modules for use in subsequent drupalModuleEnable calls.
$this->_modules = drupal_map_assoc($modules);
$this->_modules['system'] = 'system';
// Run defualt profile tasks.
// Run default profile tasks.
$task = 'profile';
default_profile_tasks($task, '');
......
......@@ -21,10 +21,7 @@ class TrackerTest extends DrupalWebTestCase {
* Implementation of setUp().
*/
function setUp() {
parent::setUp();
$this->drupalModuleEnable('comment');
$this->drupalModuleEnable('tracker');
parent::setUp('comment', 'tracker');
$permissions = array('access comments', 'post comments', 'post comments without approval');
$this->user = $this->drupalCreateUser($permissions);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment