Index: modules/taxonomy/taxonomy.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.test,v
retrieving revision 1.13
diff -u -p -r1.13 taxonomy.test
--- modules/taxonomy/taxonomy.test	16 Nov 2008 14:59:33 -0000	1.13
+++ modules/taxonomy/taxonomy.test	18 Nov 2008 22:19:01 -0000
@@ -57,6 +57,100 @@ class TaxonomyVocabularyFunctionalTest e
     $this->drupalGet('admin/content/taxonomy');
     $this->assertText($edit['name'], t('Vocabulary found in the vocabulary overview listing.'));
   }
+
+  /**
+   * Changing weights on the vocabulary overview with two or more vocabularies.
+   */
+  function testTaxonomyAdminChangingWeights() {
+    $this->drupalLogin($this->admin_user);
+
+    // Create some vocabularies.
+    for ($i = -10; $i <= 10; $i++) {
+      $edit = array(
+        'name' => $this->randomName(),
+        'nodes[article]' => 'article',
+        'weight' => $i,
+      );
+      $this->drupalPost('admin/content/taxonomy/add', $edit, t('Save'));
+    }
+
+    // Get the vocabularies and change their weights.
+    $vocabularies = taxonomy_get_vocabularies();
+    $edit = array();
+    foreach ($vocabularies as $key => $vocabulary) {
+      $vocabulary->weight = -$vocabulary->weight;
+      $vocabularies[$key]->weight = $vocabulary->weight;
+      $edit[$key .'[weight]'] = $vocabulary->weight;
+    }
+    // Saving the new weights via the interface.
+    $this->drupalPost('admin/content/taxonomy/', $edit, t('Save'));
+
+    // Load the vocabularies from the database.
+    $new_vocabularies = taxonomy_get_vocabularies();
+
+    // Check that the weights are saved in the database correctly.
+    foreach ($vocabularies as $key => $vocabulary) {
+      $this->assertEqual($new_vocabularies[$key]->weight, $vocabularies[$key]->weight, t('The vocabulary weight was changed.'));
+    }
+  }
+
+  /**
+   * Test the vocabulary overview with no vocabularies.
+   */
+  function testTaxonomyAdminNoVocabularies() {
+    $this->drupalLogin($this->admin_user);
+
+    // Delete all vocabularies.
+    $vocabularies = taxonomy_get_vocabularies();
+    foreach ($vocabularies as $key => $vocabulary) {
+      $edit = array();
+      $this->drupalPost('admin/content/taxonomy/' . $vocabulary->vid, $edit, t('Delete'));
+      // Submit the confirm form for deletion.
+      $this->drupalPost(NULL, NULL, t('Delete'));
+    }
+    // Check that no vocabularies are found.
+    $this->assertText(t('No vocabularies available.'), t('No vocabularies were found.'));
+  }
+
+  /**
+   * Deleting a vocabulary.
+   */
+  function testTaxonomyAdminDeletingVocabulary() {
+    $this->drupalLogin($this->admin_user);
+
+    // Create a vocabulary.
+    $this->drupalGet('admin/content/taxonomy');
+    $this->assertResponse('200');
+    $this->drupalGet('admin/content/taxonomy/add');
+    $this->assertResponse('200');
+    $edit = array(
+      'name' => $this->randomName(),
+      'nodes[article]' => 'article',
+    );
+    $this->drupalPost('admin/content/taxonomy/add', $edit, t('Save'));
+    $this->assertResponse('200');
+    $this->assertText(t('Created new vocabulary'), t('New vocabulary was created.'));
+
+    // Check the created vocabulary.
+    $vocabularies = taxonomy_get_vocabularies();
+    $vid = $vocabularies[count($vocabularies)-1]->vid;
+    $vocabulary = taxonomy_vocabulary_load($vid, TRUE);
+    $this->assertTrue($vocabulary, t('Vocabulary found in database'));
+
+    // Delete the vocabulary.
+    $this->drupalGet('admin/content/taxonomy/'. $vid);
+    $this->assertResponse('200');
+    $edit = array();
+    $this->drupalPost('admin/content/taxonomy/' .$vid, $edit, t('Delete'));
+    $this->assertResponse('200');
+    $this->assertRaw(t('Are you sure you want to delete the vocabulary %name?', array('%name' => $vocabulary->name)), t('[confirm deletion] Asks for confirmation.'));
+    $this->assertText(t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'), t('[confirm deletion] Inform that all terms will be deleted.'));
+
+    // Confirm deletion.
+    $this->drupalPost(NULL, NULL, t('Delete'));
+    $this->assertRaw(t('Deleted vocabulary %name.', array('%name' => $vocabulary->name)), t('Vocabulary deleted'));
+    $this->assertFalse(taxonomy_vocabulary_load($vid, TRUE), t('Vocabulary is not found in the database'));
+  }
 }
 
 
