Test uninstall and reinstall of the taxonomy module.
function testUninstallReinstall() {
// Fields and field instances attached to taxonomy term bundles should be
// removed when the module is uninstalled.
$this->field_name = drupal_strtolower($this
->randomName() . '_field_name');
$this->field_definition = array(
'field_name' => $this->field_name,
'type' => 'text',
'cardinality' => 4,
);
field_create_field($this->field_definition);
$this->instance_definition = array(
'field_name' => $this->field_name,
'entity_type' => 'taxonomy_term',
'bundle' => $this->vocabulary
->id(),
'label' => $this
->randomName() . '_label',
);
field_create_instance($this->instance_definition);
module_disable(array(
'taxonomy',
));
require_once DRUPAL_ROOT . '/core/includes/install.inc';
module_uninstall(array(
'taxonomy',
));
module_enable(array(
'taxonomy',
));
// Now create a vocabulary with the same name. All field instances
// connected to this vocabulary name should have been removed when the
// module was uninstalled. Creating a new field with the same name and
// an instance of this field on the same bundle name should be successful.
$this->vocabulary
->enforceIsNew();
$this->vocabulary
->save();
field_create_field($this->field_definition);
field_create_instance($this->instance_definition);
}