Permalink
Browse files

Issue #1391384 by yched, oriol_e9g: Fixed Wrong static clear on taxon…

…omy_vocabulary_save().
  • Loading branch information...
1 parent 60dcf95 commit 6f58aa16f0066d59c9e16a855ab1886d72f8d472 @webchick webchick committed Jan 12, 2012
Showing with 8 additions and 1 deletion.
  1. +2 −1 modules/taxonomy/taxonomy.module
  2. +6 −0 modules/taxonomy/taxonomy.test
@@ -428,6 +428,7 @@ function taxonomy_vocabulary_save($vocabulary) {
if (!empty($vocabulary->vid) && !empty($vocabulary->name)) {
$status = drupal_write_record('taxonomy_vocabulary', $vocabulary, 'vid');
+ taxonomy_vocabulary_static_reset(array($vocabulary->vid));
if ($vocabulary->old_machine_name != $vocabulary->machine_name) {
field_attach_rename_bundle('taxonomy_term', $vocabulary->old_machine_name, $vocabulary->machine_name);
}
@@ -436,14 +437,14 @@ function taxonomy_vocabulary_save($vocabulary) {
}
elseif (empty($vocabulary->vid)) {
$status = drupal_write_record('taxonomy_vocabulary', $vocabulary);
+ taxonomy_vocabulary_static_reset();
field_attach_create_bundle('taxonomy_term', $vocabulary->machine_name);
module_invoke_all('taxonomy_vocabulary_insert', $vocabulary);
module_invoke_all('entity_insert', $vocabulary, 'taxonomy_vocabulary');
}
unset($vocabulary->original);
cache_clear_all();
- taxonomy_vocabulary_static_reset(array($vocabulary->vid));
return $status;
}
@@ -1290,10 +1290,16 @@ class TaxonomyTermFieldTestCase extends TaxonomyWebTestCase {
);
field_update_field($this->field);
// 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]), t('The old bundle name does not appear in entity_get_info().'));
+ $this->assertTrue(isset($info['bundles'][$new_name]), t('The new bundle name appears in entity_get_info().'));
+
// Check that the field instance is still attached to the vocabulary.
$field = field_info_field($this->field_name);
$allowed_values = $field['settings']['allowed_values'];

0 comments on commit 6f58aa1

Please sign in to comment.