? 115315.profile_autocomplete.patch
? 223820-core-book-empty-log.patch
? 261258-node-save-required-fields-3.patch
? 299136-book-test-extended.patch
? anon_user_0.patch
? file_test_cleanup_0.patch
? filterTips_0.patch
? filter_administration.patch
? help.test.patch
? recentPollTest.3.patch
? taxonomy-reset-vocabulary-cache-296910-1.patch
? taxonomy_isset_plus_test.patch
? taxonomy_isset_plus_test.patch.1
? trackerfix.patch
? upload_test_0.patch
? vocabulary_static_reset.patch
? modules/forum/.forum.test.swp
? modules/simpletest/tests/file_test.info
? modules/simpletest/tests/file_test.module
? modules/taxonomy/.taxonomy.test.swp
? modules/taxonomy/taxonomy_vocabulary_load.patch
? sites/default/files
? sites/default/settings.php
Index: modules/taxonomy/taxonomy.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v
retrieving revision 1.427
diff -u -p -r1.427 taxonomy.module
--- modules/taxonomy/taxonomy.module	19 Sep 2008 20:25:03 -0000	1.427
+++ modules/taxonomy/taxonomy.module	22 Sep 2008 16:52:23 -0000
@@ -992,9 +992,9 @@ function taxonomy_get_term_by_name($name
  *   Results are statically cached.
  */
 function taxonomy_vocabulary_load($vid) {
-  static $vocabularies = array();
+    static $vocabularies = array();
 
-  if (!isset($vocabularies[$vid])) {
+  if (empty($vocabularies[$vid])) {
     // Initialize so if this vocabulary does not exist, we have
     // that cached, and we will not try to load this later.
     $vocabularies[$vid] = FALSE;
Index: modules/taxonomy/taxonomy.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.test,v
retrieving revision 1.6
diff -u -p -r1.6 taxonomy.test
--- modules/taxonomy/taxonomy.test	19 Sep 2008 20:25:03 -0000	1.6
+++ modules/taxonomy/taxonomy.test	22 Sep 2008 16:52:24 -0000
@@ -1,6 +1,56 @@
 <?php
 // $Id: taxonomy.test,v 1.6 2008/09/19 20:25:03 dries Exp $
 
+class TaxonomyVocabularyLoadTestCase extends DrupalWebTestCase {
+  /**
+   * Implementation of getInfo().
+   */
+   function getInfo() {
+     return array(
+       'name' => t('Loading taxonomy vocabularies'),
+       'description' => t('Test loading vocabularies under various conditions.'),
+       'group' => t('Taxonomy'),
+     );
+   }
+
+  /**
+   * Implementation of setUp() {
+   */
+  function setUp() {
+    parent::setUp('taxonomy');
+    $admin_user = $this->drupalCreateUser(array('administer taxonomy'));
+    $this->drupalLogin($admin_user);
+  }
+
+  /**
+   * Ensure that when an invalid vocabulary vid is loaded, it is possible
+   * to load the same vid successfully if it subsequently becomes valid.
+   */
+  function testTaxonomyVocabularyLoadReturnFalse() {
+    // Load a vocabulary that doesn't exist.
+    $vocabularies = taxonomy_get_vocabularies();
+    $vid = count($vocabularies) +1;
+    $vocabulary = taxonomy_vocabulary_load($vid);
+    // This should not return an object because no such vocabulary exists.
+    $this->assertTrue(!is_object($vocabulary), t('No object loaded.'));
+
+    // Create a new vocabulary.
+    $edit = array(
+      'name' => $this->randomName(),
+      'description' => $this->randomName(),
+      'help' => '',
+      'weight' => 0,
+    );
+    $this->drupalPost('admin/content/taxonomy/add/vocabulary', $edit, t('Save'));
+
+    // Load the vocabulary with the same $vid from earlier.
+    // This should return a vocabulary object since it now matches a real vid.
+    $vocabulary = taxonomy_vocabulary_load($vid);
+    $this->assertTrue(is_object($vocabulary), t('Vocabulary is an object'));
+    $this->assertTrue($vocabulary->vid == $vid, t('Valid vocabulary vid is the same as our previously invalid one.'));
+  }
+}
+
 class TaxonomyVocabularyFunctionsTestCase extends DrupalWebTestCase {
   /**
    * Implementation of getInfo().
@@ -8,12 +58,21 @@ class TaxonomyVocabularyFunctionsTestCas
   function getInfo() {
     return array(
       'name' => t('Vocabulary functions'),
-      'description' => t('Create/Edit/Delete vocabulary and assert that all fields were properly saved.'),
+      'description' => t('Test loading, saving, and deleting vocabularies.'),
       'group' => t('Taxonomy')
     );
   }
 
   /**
+   * Implementation of setUp().
+   */
+  function setUp() {
+    parent::setUp('taxonomy');
+    $admin_user = $this->drupalCreateUser(array('administer taxonomy'));
+    $this->drupalLogin($admin_user);
+  }
+
+  /**
    * Create/Edit/Delete vocabulary and assert that all fields were properly saved.
    */
   function testVocabularyFunctions() {
@@ -81,7 +140,6 @@ class TaxonomyVocabularyFunctionsTestCas
   }
 }
 
-
 class TaxonomyTermFunctionsTestCase extends DrupalWebTestCase {
   /**
    * Implementation of getInfo().
