diff --git a/modules/taxonomy/taxonomy.test b/modules/taxonomy/taxonomy.test index 2a7f36b..b5600a2 100644 --- a/modules/taxonomy/taxonomy.test +++ b/modules/taxonomy/taxonomy.test @@ -627,6 +627,11 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { $this->drupalGet('node/' . $node->nid); $this->assertText($term1->name, 'Term is displayed when viewing the node.'); + $this->clickLink(t('Edit')); + $this->assertText($term1->name, 'Term is displayed when editing the node.'); + $this->drupalPost(NULL, array(), t('Save')); + $this->assertText($term1->name, 'Term is displayed after saving the node with no changes.'); + // Edit the node with a different term. $edit[$this->instance['field_name'] . '[' . $langcode . '][]'] = $term2->tid; $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); @@ -995,6 +1000,32 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { $this->assertEqual(count($terms), 0, 'No terms loaded when restricted by a non-existing vocabulary.'); } + /** + * Tests that editing and saving a node with no changes works correctly. + */ + function testReSavingTags() { + // Enable tags in the vocabulary. + $instance = $this->instance; + $instance['widget'] = array('type' => 'taxonomy_autocomplete'); + field_update_instance($instance); + + // Create a term and a node using it. + $term = $this->createTerm($this->vocabulary); + $langcode = LANGUAGE_NONE; + $edit = array(); + $edit["title"] = $this->randomName(8); + $edit["body[$langcode][0][value]"] = $this->randomName(16); + $edit[$this->instance['field_name'] . '[' . $langcode . ']'] = $term->name; + $this->drupalPost('node/add/article', $edit, t('Save')); + + // Check that the term is displayed when editing and saving the node with no + // changes. + $this->clickLink(t('Edit')); + $this->assertRaw($term->name, 'Term is displayed when editing the node.'); + $this->drupalPost(NULL, array(), t('Save')); + $this->assertRaw($term->name, 'Term is displayed after saving the node with no changes.'); + } + } /**