diff --git a/core/modules/simpletest/tests/registry_test.info b/core/modules/simpletest/tests/registry_test.info new file mode 100644 index 0000000..147d33d --- /dev/null +++ b/core/modules/simpletest/tests/registry_test.info @@ -0,0 +1,6 @@ +name = Registry test +description = Support module for registry testing. +package = Testing +version = VERSION +core = 8.x +hidden = TRUE diff --git a/core/modules/simpletest/tests/registry_test.module b/core/modules/simpletest/tests/registry_test.module new file mode 100644 index 0000000..0e94ab9 --- /dev/null +++ b/core/modules/simpletest/tests/registry_test.module @@ -0,0 +1,36 @@ +uri)); + $stream_wrapper = new $wrapper_class; + $directory = $stream_wrapper->getDirectoryPath(); + $target = file_uri_target($file->uri); + $files["$directory/$target"] = array('module' => 'registry_test', 'weight' => 0); +} + +/** + * Implements hook_menu(). + */ +function registry_test_menu() { + $items['registry-test/load-resource'] = array( + 'title' => 'Load a resource', + 'page callback' => 'registry_test_load_resource', + 'access callback' => TRUE, + 'type' => MENU_CALLBACK, + ); + return $items; +} + +/** + * Menu callback: load a class and print it out. + */ +function registry_test_load_resource() { + return array( + '#markup' => '
' . print_r(new RegistryTestClass(), TRUE) . '
', + ); +} + diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 9780ed2..b2e108a 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -3093,6 +3093,7 @@ function _registry_check_code($type, $name = NULL) { * each interface or class in the database. */ function registry_rebuild() { + drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); system_rebuild_module_data(); registry_update(); } diff --git a/core/modules/simpletest/tests/registry.test b/core/modules/simpletest/tests/registry.test index bcd8d4e..93cde27 100644 --- a/core/modules/simpletest/tests/registry.test +++ b/core/modules/simpletest/tests/registry.test @@ -140,3 +140,45 @@ CONTENTS; } } + +class RegistryMovedResourceTestCase extends DrupalWebTestCase { + + public $profile = 'testing'; + + public static function getInfo() { + return array( + 'name' => 'Registry move resources test', + 'description' => "Change where a test module's class lives, and test we can recover.", + 'group' => 'System' + ); + } + + protected function moveRegistryResource() { + file_delete(variable_get('registry_test_class_file')); + variable_set('registry_test_class_file', $this->writeOutClassFile()); + } + + protected function writeOutClassFile() { + $chrs = hash('sha256', microtime() . mt_rand()); + $file_contents = <<writeOutClassFile()); + module_enable(array('registry_test')); + menu_rebuild(); + } + + public function testRegistryMovedResource() { + $this->drupalGet('registry-test/load-resource'); + $this->moveRegistryResource(); + $this->drupalGet('registry-test/load-resource'); + } +} + diff --git a/core/update.php b/core/update.php index ac3b255..ac1553f 100644 --- a/core/update.php +++ b/core/update.php @@ -379,6 +379,8 @@ if (empty($op) && update_access_allowed()) { // in updated code are picked up. module_implements_reset(); + registry_rebuild(); + // Set up $language, since the installer components require it. drupal_language_initialize();