summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2012-01-31 02:51:45 -0800
committerwebchick <webchick@24967.no-reply.drupal.org>2012-01-31 02:51:45 -0800
commit4dafc577cc8de7fbd039a22f6f32e60b310368e2 (patch)
tree5ebeb138960cbe3e60de03c9e890a82af4c756eb
parentc12fac5669408d874c4df874d802fdf0382eca0d (diff)
downloadbrdo-4dafc577cc8de7fbd039a22f6f32e60b310368e2.tar.gz
brdo-4dafc577cc8de7fbd039a22f6f32e60b310368e2.tar.bz2
Issue #996236 by fago, sun, pillarsdotnet, xjm: Fixed drupal_flush_all_caches() does not clear entity info cache.
-rw-r--r--includes/common.inc1
-rw-r--r--includes/module.inc1
-rw-r--r--modules/simpletest/tests/entity_cache_test_dependency.module2
-rw-r--r--modules/system/system.test26
4 files changed, 26 insertions, 4 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 5e90f78f1..43e211813 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -7244,6 +7244,7 @@ function drupal_flush_all_caches() {
system_rebuild_theme_data();
drupal_theme_rebuild();
+ entity_info_cache_clear();
node_types_rebuild();
// node_menu() defines menu items based on node types so it needs to come
// after node types are rebuilt.
diff --git a/includes/module.inc b/includes/module.inc
index 633b317f6..77e35b7b0 100644
--- a/includes/module.inc
+++ b/includes/module.inc
@@ -539,6 +539,7 @@ function module_disable($module_list, $disable_dependents = TRUE) {
system_list_reset();
module_list(TRUE);
module_implements('', FALSE, TRUE);
+ entity_info_cache_clear();
// Invoke hook_modules_disabled before disabling modules,
// so we can still call module hooks to get information.
module_invoke_all('modules_disabled', $invoke_modules);
diff --git a/modules/simpletest/tests/entity_cache_test_dependency.module b/modules/simpletest/tests/entity_cache_test_dependency.module
index 73a11495f..2d4b3be4d 100644
--- a/modules/simpletest/tests/entity_cache_test_dependency.module
+++ b/modules/simpletest/tests/entity_cache_test_dependency.module
@@ -11,7 +11,7 @@
function entity_cache_test_dependency_entity_info() {
return array(
'entity_cache_test' => array(
- 'label' => 'Entity Cache Test',
+ 'label' => variable_get('entity_cache_test_label', 'Entity Cache Test'),
),
);
}
diff --git a/modules/system/system.test b/modules/system/system.test
index ccb237d74..f40bd686a 100644
--- a/modules/system/system.test
+++ b/modules/system/system.test
@@ -272,12 +272,32 @@ class EnableDisableTestCase extends ModuleTestCase {
}
/**
- * Tests entity cache after enabling a module with a dependency on an enitity
- * providing module.
+ * Ensures entity info cache is updated after changes.
+ */
+ function testEntityInfoChanges() {
+ module_enable(array('entity_cache_test'));
+ $entity_info = entity_get_info();
+ $this->assertTrue(isset($entity_info['entity_cache_test']), 'Test entity type found.');
+
+ // Change the label of the test entity type and make sure changes appear
+ // after flushing caches.
+ variable_set('entity_cache_test_label', 'New label.');
+ drupal_flush_all_caches();
+ $info = entity_get_info('entity_cache_test');
+ $this->assertEqual($info['label'], 'New label.', 'New label appears in entity info.');
+
+ // Disable the providing module and make sure the entity type is gone.
+ module_disable(array('entity_cache_test', 'entity_cache_test_dependency'));
+ $entity_info = entity_get_info();
+ $this->assertFalse(isset($entity_info['entity_cache_test']), 'Entity type of the providing module is gone.');
+ }
+
+ /**
+ * Tests entity info cache after enabling a module with a dependency on an entity providing module.
*
* @see entity_cache_test_watchdog()
*/
- function testEntityCache() {
+ function testEntityInfoCacheWatchdog() {
module_enable(array('entity_cache_test'));
$info = variable_get('entity_cache_test');
$this->assertEqual($info['label'], 'Entity Cache Test', 'Entity info label is correct.');