Index: modules/taxonomy/taxonomy.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.admin.inc,v
retrieving revision 1.27
diff -u -p -r1.27 taxonomy.admin.inc
--- modules/taxonomy/taxonomy.admin.inc	16 Jul 2008 21:59:28 -0000	1.27
+++ modules/taxonomy/taxonomy.admin.inc	11 Sep 2008 16:31:16 -0000
@@ -286,7 +286,7 @@ function taxonomy_overview_terms(&$form_
     // We are not calling taxonomy_get_tree because that might fail with a big
     // number of tags in the freetagging vocabulary.
     $results = pager_query(db_rewrite_sql('SELECT t.*, h.parent FROM {term_data} t INNER JOIN {term_hierarchy} h ON t.tid = h.tid WHERE t.vid = %d ORDER BY weight, name', 't', 'tid'), $page_increment, 0, NULL, $vocabulary->vid);
-    $total_entries = db_query(db_rewrite_sql('SELECT count(*) FROM {term_data} t INNER JOIN {term_hierarchy} h ON t.tid = h.tid WHERE t.vid = %d'), $page_increment, 0, NULL, $vocabulary->vid);
+    $total_entries = db_query(db_rewrite_sql('SELECT count(*) FROM {term_data} t INNER JOIN {term_hierarchy} h ON t.tid = h.tid WHERE t.vid = :vid'), array(':vid' => $vocabulary->vid));
     while ($term = db_fetch_object($results)) {
       $key = 'tid:' . $term->tid . ':0';
       $current_page[$key] = $term;
@@ -928,7 +928,7 @@ function taxonomy_vocabulary_confirm_res
  * @see taxonomy_vocabulary_confirm_reset_alphabetical()
  */
 function taxonomy_vocabulary_confirm_reset_alphabetical_submit($form, &$form_state) {
-  db_query('UPDATE {term_data} t SET weight = 0 WHERE vid = %d', $form_state['values']['vid']);
+  db_query('UPDATE {term_data} t SET weight = 0 WHERE vid = :vid', array(':vid' => $form_state['values']['vid']));
   drupal_set_message(t('Reset vocabulary %name to alphabetical order.', array('%name' => $form_state['values']['name'])));
   watchdog('taxonomy', 'Reset vocabulary %name to alphabetical order.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE);
   $form_state['redirect'] = 'admin/content/taxonomy/' . $form_state['values']['vid'];
Index: modules/taxonomy/taxonomy.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.test,v
retrieving revision 1.3
diff -u -p -r1.3 taxonomy.test
--- modules/taxonomy/taxonomy.test	8 Sep 2008 21:37:21 -0000	1.3
+++ modules/taxonomy/taxonomy.test	11 Sep 2008 16:31:16 -0000
@@ -284,6 +284,44 @@ class TaxonomyTermMultipleTestCase exten
 
 }
 
+class TaxonomyAdminTestCase extends DrupalWebTestCase {
+  /**
+   * Implementation of getInfo().
+   */
+  function getInfo() {
+    return array(
+      'name' => t('Administration interface'),
+      'description' => t('Test the vocabulary administration interface.'),
+      'group' => t('Taxonomy'),
+    );
+  }
+
+  /**
+   * Implementation of setUp().
+   */
+  function setUp() {
+    parent::setUp();
+    $this->taxonomy_admin = $this->drupalCreateUser(array('administer taxonomy'));
+  }
+
+  /**
+   * Visit the various admin pages for the default 'Tags' vocabulary.
+   */
+  function testTaxonomyAdminPages() {
+    $this->drupalLogin($this->taxonomy_admin);
+    $this->drupalGet('admin/content/taxonomy');
+    $this->assertResponse('200');
+    $this->assertText(t('Article'), t('Article vocabulary found.'));
+    $this->clickLink(t('edit vocabulary'));
+    $this->assertResponse('200');
+    $this->drupalGet('admin/content/taxonomy');
+    $this->clickLink(t('list terms'));
+    $this->assertResponse('200');
+    $this->clickLink(t('Add term'));
+    $this->assertResponse('200');
+  }
+}
+
 class TaxonomyTestNodeApiTestCase extends DrupalWebTestCase {
   /**
    * Implementation of getInfo().
@@ -292,7 +330,7 @@ class TaxonomyTestNodeApiTestCase extend
     return array(
       'name' => t('Taxonomy nodeapi'),
       'description' => t('Save & edit a node and assert that taxonomy terms are saved/loaded properly.'),
-      'group' => t('Taxonomy')
+      'group' => t('Taxonomy'),
     );
   }
 
@@ -420,3 +458,63 @@ class TaxonomyTestNodeApiTestCase extend
     taxonomy_save_vocabulary($edit);
   }
 }
+
+
+class TermEditTestCase extends DrupalWebTestCase {
+  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.'),
+      'group' => t('Taxonomy'));
+  }
+  function setUp() {
+    parent::setUp();
+    // Prepare a user to do the tests
+    $web_user = $this->drupalCreateUser(array('administer taxonomy'));
+    $this->drupalLogin($web_user);
+  }
+
+  function testTermEdit() {
+    $edit = array(
+      'name' => $this->randomName(12),
+      'description' => $this->randomName(100),
+    );
+
+    // Create the term to edit (adding to the default 'Tags' vocabulary)
+    $this->drupalPost('admin/content/taxonomy/1/add/term', $edit, t('Save'));
+
+    $term = taxonomy_get_term_by_name($edit['name']);
+    $this->assertNotNull($term, t('Term found in database'));
+
+    // Submitting a term takes us to the add page; we need the List page
+    $this->clickLink(t('List'));
+
+    // Test edit link as accessed from Taxonomy administration pages
+    // because Simpletest creates its own database when running tests
+    // we know the first edit link found on the listing page is to our term
+    $this->clickLink(t('edit'));
+
+    // this failed inexplicably with assertText, using assertRaw
+    $this->assertRaw($edit['name'], t('The randomly generated term name is present.'));
+    $this->assertText($edit['description'], t('The randomly generated term description is present.'));
+
+    $edit = array(
+      'name' => $this->randomName(14),
+      'description' => $this->randomName(102),
+    );
+
+    // edit the term
+    $this->drupalPost('admin/content/taxonomy/edit/term/'. $term[0]->tid, $edit, t('Save'));
+
+    // view the term and check that it is correct
+    $this->drupalGet('taxonomy/term/1');
+    $this->assertText($edit['name'], t('The randomly generated term name is present.'));
+    $this->assertText($edit['description'], t('The randomly generated term description is present.'));
+  }
+
+  function tearDown() {
+    parent::tearDown();
+  }
+}
+
