diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2008-11-30 07:04:45 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2008-11-30 07:04:45 +0000 |
commit | f3ad4d956825958798de4cd7b5cbcc7dd3f1ab1b (patch) | |
tree | 71a0bbbb9fe27d56c557d6c3522fb5f92b3a9665 /modules | |
parent | aa4b94fcc9970731ae07c6f9a2a16b53918ed9b5 (diff) | |
download | brdo-f3ad4d956825958798de4cd7b5cbcc7dd3f1ab1b.tar.gz brdo-f3ad4d956825958798de4cd7b5cbcc7dd3f1ab1b.tar.bz2 |
#340052 by justinrandell: Speed up SimpleTest by 15,000 orders of magnitude by pre-loading the registry.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/simpletest/drupal_web_test_case.php | 13 |
1 files changed, 12 insertions, 1 deletions
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(); @@ -813,6 +814,16 @@ class DrupalWebTestCase { } /** + * 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. * |