diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-06-20 18:32:04 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-06-20 18:32:04 +0000 |
commit | de0945e9294eecdfc00c54fab61d6d54e12f15eb (patch) | |
tree | 43d27b25e0c7c9acaafc1320f90291eda4d00086 | |
parent | 344aed13f5390a73da68a59bb3cbc54695ac2425 (diff) | |
download | brdo-de0945e9294eecdfc00c54fab61d6d54e12f15eb.tar.gz brdo-de0945e9294eecdfc00c54fab61d6d54e12f15eb.tar.bz2 |
- Patch #490432 by mfb, catch, bangpound: taxonomy_form_vocabulary always returned error.
-rw-r--r-- | modules/taxonomy/taxonomy.admin.inc | 2 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.test | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/modules/taxonomy/taxonomy.admin.inc b/modules/taxonomy/taxonomy.admin.inc index 177db165e..d92214086 100644 --- a/modules/taxonomy/taxonomy.admin.inc +++ b/modules/taxonomy/taxonomy.admin.inc @@ -222,7 +222,7 @@ function taxonomy_form_vocabulary_validate($form, &$form_state) { // Do not allow duplicate machine names. $vocabularies = taxonomy_get_vocabularies(); foreach ($vocabularies as $vocabulary) { - if ($machine_name == $vocabulary->machine_name && (!(isset($form_state['values']['vid']) && $vocabulary->vid != $form_state['values']['vid']))) { + if ($machine_name == $vocabulary->machine_name && (!isset($form_state['values']['vid']) || $vocabulary->vid != $form_state['values']['vid'])) { form_set_error('machine_name', t('This machine-readable name is already in use by another vocabulary and must be unique.')); } } diff --git a/modules/taxonomy/taxonomy.test b/modules/taxonomy/taxonomy.test index 6264ba824..897dc5220 100644 --- a/modules/taxonomy/taxonomy.test +++ b/modules/taxonomy/taxonomy.test @@ -69,9 +69,10 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase { // Create a new vocabulary. $this->clickLink(t('Add vocabulary')); $edit = array(); + $machine_name = drupal_strtolower($this->randomName()); $edit['name'] = $this->randomName(); $edit['description'] = $this->randomName(); - $edit['machine_name'] = drupal_strtolower($this->randomName()); + $edit['machine_name'] = $machine_name; $edit['help'] = $this->randomName(); $edit['nodes[article]'] = 'article'; $edit['tags'] = 1; @@ -86,12 +87,12 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase { $this->clickLink(t('edit vocabulary')); $edit = array(); $edit['name'] = $this->randomName(); - $edit['machine_name'] = drupal_strtolower($this->randomName()); $this->drupalPost(NULL, $edit, t('Save')); $this->drupalGet('admin/content/taxonomy'); $this->assertText($edit['name'], t('Vocabulary found in the vocabulary overview listing.')); // Try to submit a vocabulary with a duplicate machine name. + $edit['machine_name'] = $machine_name; $this->drupalPost('admin/content/taxonomy/add', $edit, t('Save')); $this->assertText(t('This machine-readable name is already in use by another vocabulary and must be unique.'), t('Duplicate machine name validation was successful')); |