diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-09-01 02:05:36 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-09-01 02:05:36 +0000 |
commit | 0dc56ece61e0b772f30ed6d53294befc4da3b6a3 (patch) | |
tree | 84ca5b5905d61d959a6cd7aa14a26c56506c648c /modules/simpletest/drupal_web_test_case.php | |
parent | 7b2c2c7de3f7102b161d562b4a98a095278e8c87 (diff) | |
download | brdo-0dc56ece61e0b772f30ed6d53294befc4da3b6a3.tar.gz brdo-0dc56ece61e0b772f30ed6d53294befc4da3b6a3.tar.bz2 |
- Patch #895822 by salvis: make SimpleTests inheritable.
Diffstat (limited to 'modules/simpletest/drupal_web_test_case.php')
-rw-r--r-- | modules/simpletest/drupal_web_test_case.php | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index d9a1fa29c..d3fcda1fb 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -1227,19 +1227,8 @@ class DrupalWebTestCase extends DrupalTestCase { 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 @@ class DrupalWebTestCase extends DrupalTestCase { } /** - * 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'); @@ -1277,6 +1268,29 @@ class DrupalWebTestCase extends DrupalTestCase { } /** + * 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. * |