Tests that the module list is retained after enabling/installing/disabling modules.
function testEnableModulesFixedList() {
// entity_test is loaded via $modules; its entity type should exist.
$this
->assertEqual($this->container
->get('module_handler')
->moduleExists('entity_test'), TRUE);
$this
->assertTrue(TRUE == entity_get_info('entity_test'));
// Load some additional modules; entity_test should still exist.
$this
->enableModules(array(
'entity',
'field',
'field_sql_storage',
'text',
'entity_test',
));
$this
->assertEqual($this->container
->get('module_handler')
->moduleExists('entity_test'), TRUE);
$this
->assertTrue(TRUE == entity_get_info('entity_test'));
// Install some other modules; entity_test should still exist.
module_enable(array(
'field',
'field_sql_storage',
'field_test',
), FALSE);
$this
->assertEqual($this->container
->get('module_handler')
->moduleExists('entity_test'), TRUE);
$this
->assertTrue(TRUE == entity_get_info('entity_test'));
// Disable one of those modules; entity_test should still exist.
module_disable(array(
'field_test',
));
$this
->assertEqual($this->container
->get('module_handler')
->moduleExists('entity_test'), TRUE);
$this
->assertTrue(TRUE == entity_get_info('entity_test'));
// Set the weight of a module; entity_test should still exist.
module_set_weight('entity', -1);
$this
->assertEqual($this->container
->get('module_handler')
->moduleExists('entity_test'), TRUE);
$this
->assertTrue(TRUE == entity_get_info('entity_test'));
// Reactivate the disabled module without enabling it.
$this
->enableModules(array(
'field_test',
));
// Create a field and an instance.
$display = entity_create('entity_display', array(
'targetEntityType' => 'entity_test',
'bundle' => 'entity_test',
'mode' => 'default',
));
$field = array(
'field_name' => 'test_field',
'type' => 'test_field',
);
field_create_field($field);
$instance = array(
'field_name' => $field['field_name'],
'entity_type' => 'entity_test',
'bundle' => 'entity_test',
);
field_create_instance($instance);
}