Commit f3ad4d95 authored by webchick's avatar webchick

#340052 by justinrandell: Speed up SimpleTest by 15,000 orders of magnitude by...

#340052 by justinrandell: Speed up SimpleTest by 15,000 orders of magnitude by pre-loading the registry.
parent aa4b94fc
......@@ -778,6 +778,8 @@ protected function setUp() {
include_once DRUPAL_ROOT . '/includes/install.inc';
drupal_install_system();
$this->preloadRegistry();
// Add the specified modules to the list of modules in the default profile.
$args = func_get_args();
$modules = array_unique(array_merge(drupal_get_profile_modules('default', 'en'), $args));
......@@ -794,7 +796,6 @@ protected function setUp() {
default_profile_tasks($task, '');
// Rebuild caches.
menu_rebuild();
actions_synchronize();
_drupal_flush_css_js();
$this->refreshVariables();
......@@ -812,6 +813,16 @@ protected function setUp() {
file_check_directory($directory, FILE_CREATE_DIRECTORY); // Create the files directory.
}
/**
* 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 the a clean environment for the current test run.
*/
protected function preloadRegistry() {
db_query('INSERT INTO {registry} SELECT * FROM ' . $this->originalPrefix . 'registry');
db_query('INSERT INTO {registry_file} SELECT * FROM ' . $this->originalPrefix . 'registry_file');
}
/**
* 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