summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcatch2012-01-18 13:02:34 +0900
committercatch2012-01-18 13:02:34 +0900
commitc95075ec68de3a30e6b726089be058e393df48f8 (patch)
tree52c94d91d6fcf949f96a19fb295d5bdf7af6b93e
parent8e20a82ed5fedb932e9b6b3d4ba1b8ebb239822b (diff)
Issue #996236 by fago, sun, pillarsdotnet: Fixed drupal_flush_all_caches() does not clear entity info cache.
-rw-r--r--core/includes/common.inc2
-rw-r--r--core/modules/entity/tests/entity.test47
-rw-r--r--core/modules/entity/tests/entity_cache_test_dependency.module2
-rw-r--r--core/modules/system/system.test13
4 files changed, 50 insertions, 14 deletions
diff --git a/core/includes/common.inc b/core/includes/common.inc
index 2f14740..ed57616 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -7444,6 +7444,8 @@ function drupal_flush_all_caches() {
system_rebuild_theme_data();
drupal_theme_rebuild();
+ entity_info_cache_clear();
+
// @todo D8: Split cache flushing from rebuilding.
// @see http://drupal.org/node/996236
if (module_exists('node')) {
diff --git a/core/modules/entity/tests/entity.test b/core/modules/entity/tests/entity.test
index e7a4b34..35b6ab1 100644
--- a/core/modules/entity/tests/entity.test
+++ b/core/modules/entity/tests/entity.test
@@ -66,3 +66,50 @@ class EntityAPITestCase extends DrupalWebTestCase {
$this->assertTrue(empty($all), 'Deleted all entities.');
}
}
+
+/**
+ * Tests Entity API base functionality.
+ */
+class EntityAPIInfoTestCase extends DrupalWebTestCase {
+
+ public static function getInfo() {
+ return array(
+ 'name' => 'Entity info',
+ 'description' => 'Makes sure entity info is accurately cached.',
+ 'group' => 'Entity API',
+ );
+ }
+
+ /**
+ * 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 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.');
+ $this->assertEqual($info['controller class'], 'DrupalDefaultEntityController', 'Entity controller class info is correct.');
+ }
+}
diff --git a/core/modules/entity/tests/entity_cache_test_dependency.module b/core/modules/entity/tests/entity_cache_test_dependency.module
index 73a1149..2d4b3be 100644
--- a/core/modules/entity/tests/entity_cache_test_dependency.module
+++ b/core/modules/entity/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/core/modules/system/system.test b/core/modules/system/system.test
index 36b7f0c..7e35657 100644
--- a/core/modules/system/system.test
+++ b/core/modules/system/system.test
@@ -272,19 +272,6 @@ class EnableDisableTestCase extends ModuleTestCase {
}
/**
- * Tests entity cache after enabling a module with a dependency on an enitity
- * providing module.
- *
- * @see entity_cache_test_watchdog()
- */
- function testEntityCache() {
- module_enable(array('entity_cache_test'));
- $info = variable_get('entity_cache_test');
- $this->assertEqual($info['label'], 'Entity Cache Test', 'Entity info label is correct.');
- $this->assertEqual($info['controller class'], 'DrupalDefaultEntityController', 'Entity controller class info is correct.');
- }
-
- /**
* Disables and uninstalls a module and asserts that it was done correctly.
*
* @param $module