summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngie Byron2008-11-30 07:04:45 (GMT)
committerAngie Byron2008-11-30 07:04:45 (GMT)
commitf3ad4d956825958798de4cd7b5cbcc7dd3f1ab1b (patch)
tree71a0bbbb9fe27d56c557d6c3522fb5f92b3a9665
parentaa4b94fcc9970731ae07c6f9a2a16b53918ed9b5 (diff)
#340052 by justinrandell: Speed up SimpleTest by 15,000 orders of magnitude by pre-loading the registry.
-rw-r--r--modules/simpletest/drupal_web_test_case.php13
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 73aec6f..e5d0437 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.
*