Index: modules/taxonomy/taxonomy.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.admin.inc,v retrieving revision 1.35 diff -u -p -r1.35 taxonomy.admin.inc --- modules/taxonomy/taxonomy.admin.inc 5 Nov 2008 14:08:11 -0000 1.35 +++ modules/taxonomy/taxonomy.admin.inc 9 Nov 2008 00:23:43 -0000 @@ -513,7 +513,8 @@ function taxonomy_overview_terms_submit( } // Save all updated terms. - foreach ($changed_terms as $term) { + foreach ($changed_terms as $changed) { + $term = (object)$changed; taxonomy_term_save($term); } Index: modules/taxonomy/taxonomy.module =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v retrieving revision 1.439 diff -u -p -r1.439 taxonomy.module --- modules/taxonomy/taxonomy.module 7 Nov 2008 18:52:18 -0000 1.439 +++ modules/taxonomy/taxonomy.module 9 Nov 2008 00:23:44 -0000 @@ -361,7 +361,7 @@ function taxonomy_term_save($term) { } } else { - db_insert('term_hierarchy')->field(array('tid' => $term_tid, 'parent' => $term->parent))->execute(); + db_insert('term_hierarchy')->fields(array('tid' => $term_tid, 'parent' => $term->parent))->execute(); } db_delete('term_synonym')->condition('tid', $term->tid)->execute(); @@ -685,8 +685,9 @@ function taxonomy_node_save($node, $term if (!$typed_term_tid) { $edit = array('vid' => $vid, 'name' => $typed_term); - $status = taxonomy_term_save($edit); - $typed_term_tid = $edit['tid']; + $term = (object)$edit; + $status = taxonomy_term_save($term); + $typed_term_tid = $term->tid; } // Defend against duplicate, differently cased tags Index: modules/taxonomy/taxonomy.test =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.test,v retrieving revision 1.10 diff -u -p -r1.10 taxonomy.test --- modules/taxonomy/taxonomy.test 5 Nov 2008 14:08:11 -0000 1.10 +++ modules/taxonomy/taxonomy.test 9 Nov 2008 00:23:44 -0000 @@ -542,8 +542,7 @@ class TaxonomyTestNodeApiTestCase extend } /** - * Test term edit form to ensure terms can be edited from administration page - * and that term name and description are saved. + * Test term editing and creation. */ class TermEditTestCase extends DrupalWebTestCase { /** @@ -551,9 +550,8 @@ class TermEditTestCase extends DrupalWeb */ function getInfo() { return array( - 'name' => 'Term edit test', - 'description' => t('Ensure terms can be edited from administration page - and that term name and description are saved.'), + 'name' => 'Term creation and editing ', + 'description' => t('Ensure terms can be created and saved via taxonomy administration and freetagging forms.'), 'group' => t('Taxonomy')); } @@ -563,11 +561,33 @@ class TermEditTestCase extends DrupalWeb function setUp() { parent::setUp(); // Prepare a user to do the tests. - $web_user = $this->drupalCreateUser(array('administer taxonomy')); + $web_user = $this->drupalCreateUser(array('administer taxonomy', 'create article content')); $this->drupalLogin($web_user); } /** + * Test term creation with a free-tagging vocabulary from the node form. + */ + function testNodeTermCreation() { + $terms = array( + $this->randomName(), + $this->randomName(), + $this->randomName(), + ); + $edit = array(); + $edit['title'] = $this->randomName(); + // Insert the terms in a comma separated list. Vocabulary 1 is a + // free-tagging field created by the default profile. + $edit['taxonomy[tags][1]'] = implode(', ', $terms); + $edit['body'] = $this->randomName(); + $this->drupalPost('node/add/article', $edit, t('Save')); + $this->assertRaw(t('@type %title has been created.', array('@type' => t('Article'), '%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')); + } + } + + /** * Save and edit a term and assert that the name and description are correct. */ function testTermEdit() {