Tests that machine name changes are properly reflected.
function testTaxonomyVocabularyChangeMachineName() {
// Add a field instance to the vocabulary.
$field = array(
'field_name' => 'field_test',
'type' => 'test_field',
);
field_create_field($field);
$instance = array(
'field_name' => 'field_test',
'entity_type' => 'taxonomy_term',
'bundle' => $this->vocabulary->machine_name,
);
field_create_instance($instance);
// Change the machine name.
$old_name = $this->vocabulary->machine_name;
$new_name = drupal_strtolower($this
->randomName());
$this->vocabulary->machine_name = $new_name;
taxonomy_vocabulary_save($this->vocabulary);
// Check that entity bundles are properly updated.
$info = entity_get_info('taxonomy_term');
$this
->assertFalse(isset($info['bundles'][$old_name]), 'The old bundle name does not appear in entity_get_info().');
$this
->assertTrue(isset($info['bundles'][$new_name]), 'The new bundle name appears in entity_get_info().');
// Check that the field instance is still attached to the vocabulary.
$this
->assertTrue(field_info_instance('taxonomy_term', 'field_test', $new_name), 'The bundle name was updated correctly.');
}