function EnableDisableTestCase::testEntityInfoChanges
Ensures entity info cache is updated after changes.
File
-
modules/
system/ system.test, line 277
Class
- EnableDisableTestCase
- Test module enabling/disabling functionality.
Code
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.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.