diff --git a/core/modules/taxonomy/taxonomy.test b/core/modules/taxonomy/taxonomy.test index 3e6301a..ef532a2 100644 --- a/core/modules/taxonomy/taxonomy.test +++ b/core/modules/taxonomy/taxonomy.test @@ -578,11 +578,9 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { $instance['widget'] = array('type' => 'taxonomy_autocomplete'); $instance['bundle'] = 'page'; field_create_instance($instance); - $terms = array( - $this->randomName(), - $this->randomName() . ', ' . $this->randomName(), - $this->randomName(), - ); + $term1 = $this->randomName(); + $term2 = $this->randomName() . ', ' . $this->randomName(); + $term3 = $this->randomName(); $edit = array(); $langcode = LANGUAGE_NONE; @@ -590,13 +588,13 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { $edit["body[$langcode][0][value]"] = $this->randomName(); // Insert the terms in a comma separated list. Vocabulary 1 is a // free-tagging field created by the default profile. - $edit[$instance['field_name'] . "[$langcode]"] = drupal_implode_tags($terms); + $edit[$instance['field_name'] . "[$langcode]"] = drupal_implode_tags(array($term1, $term2, $term3)); // Preview and verify the terms appear but are not created. $this->drupalPost('node/add/page', $edit, t('Preview')); - foreach ($terms as $term) { - $this->assertText($term, t('The term appears on the node preview')); - } + $this->assertText($term1); + $this->assertText($term2); + $this->assertText($term3); $tree = taxonomy_get_tree($this->vocabulary->vid); $this->assertTrue(empty($tree), t('The terms are not created on preview.')); @@ -606,12 +604,15 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { // Save, creating the terms. $this->drupalPost('node/add/page', $edit, t('Save')); $this->assertRaw(t('@type %title has been created.', array('@type' => t('Basic page'), '%title' => $edit["title"])), t('The node was created successfully')); - foreach ($terms as $term) { - $this->assertText($term, t('The term was saved and appears on the node page')); - } + $this->assertText($term1); + $this->assertText($term2); + $this->assertText($term3); // Get the created terms. - list($term1, $term2, $term3) = array_values(taxonomy_term_load_multiple(FALSE)); + foreach (array('term1', 'term2', 'term3') as $var) { + $$var = taxonomy_get_term_by_name($$var); + $$var = reset($$var); + } // Delete term 1. $this->drupalPost('taxonomy/term/' . $term1->tid . '/edit', array(), t('Delete'));