From f3ad4d956825958798de4cd7b5cbcc7dd3f1ab1b Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sun, 30 Nov 2008 07:04:45 +0000 Subject: #340052 by justinrandell: Speed up SimpleTest by 15,000 orders of magnitude by pre-loading the registry. --- modules/simpletest/drupal_web_test_case.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index 73aec6f2e..e5d043792 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -778,6 +778,8 @@ class DrupalWebTestCase { 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 @@ class DrupalWebTestCase { default_profile_tasks($task, ''); // Rebuild caches. - menu_rebuild(); actions_synchronize(); _drupal_flush_css_js(); $this->refreshVariables(); @@ -812,6 +813,16 @@ class DrupalWebTestCase { 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. -- cgit v1.2.3