Commit 0dc56ece authored by Dries's avatar Dries

- Patch #895822 by salvis: make SimpleTests inheritable.

parent 7b2c2c7d
......@@ -1227,19 +1227,8 @@ protected function setUp() {
module_enable(array($this->profile), FALSE);
}
// Rebuild caches.
drupal_static_reset();
drupal_flush_all_caches();
// Register actions declared by any modules.
actions_synchronize();
// Reload global $conf array and permissions.
$this->refreshVariables();
$this->checkPermissions(array(), TRUE);
// Reset statically cached schema for new database prefix.
drupal_get_schema(NULL, TRUE);
// Reset/rebuild all data structures after enabling the modules.
$this->resetAll();
// Run cron once in that environment, as install.php does at the end of
// the installation process.
......@@ -1266,9 +1255,11 @@ protected function setUp() {
}
/**
* This method is called by DrupalWebTestCase::setUp, and preloads the
* Preload the registry from the testing site.
*
* This method is called by DrupalWebTestCase::setUp(), and preloads the
* registry from the testing site to cut down on the time it takes to
* setup a clean environment for the current test run.
* set up a clean environment for the current test run.
*/
protected function preloadRegistry() {
$original_connection = Database::getConnection('default', 'simpletest_original_default');
......@@ -1276,6 +1267,29 @@ protected function preloadRegistry() {
db_query('INSERT INTO {registry_file} SELECT * FROM ' . $original_connection->prefixTables('{registry_file}'));
}
/**
* Reset all data structures after having enabled new modules.
*
* This method is called by DrupalWebTestCase::setUp() after enabling
* the requested modules. It must be called again when additional modules
* are enabled later.
*/
protected function resetAll() {
// Rebuild caches.
drupal_static_reset();
drupal_flush_all_caches();
// Register actions declared by any modules.
actions_synchronize();
// Reload global $conf array and permissions.
$this->refreshVariables();
$this->checkPermissions(array(), TRUE);
// Reset statically cached schema for new database prefix.
drupal_get_schema(NULL, TRUE);
}
/**
* Refresh the in-memory set of variables. Useful after a page request is made
* that changes a variable in a different thread.
......
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