? 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
? should_learn_how_to_use_git_or_something.patch
? static_tree.patch
? static_tree.patch.1
? taxonomy-reset-vocabulary-cache-296910-1.patch
? taxonomy-synonym-cache_0.patch.txt
? taxonomy_hierarchy.patch
? taxonomy_isset_plus_test.patch
? taxonomy_isset_plus_test.patch.1
? trackerfix.patch
? upload_test_0.patch
? vocabulary_static_reset.patch
? modules/simpletest/tests/file_test.info
? modules/simpletest/tests/file_test.module
? 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.429
diff -u -p -r1.429 taxonomy.module
--- modules/taxonomy/taxonomy.module	24 Sep 2008 18:42:00 -0000	1.429
+++ modules/taxonomy/taxonomy.module	24 Sep 2008 23:17:39 -0000
@@ -834,9 +834,15 @@ function taxonomy_get_children($tid, $vi
  *   to have "depth" and "parents" attributes in addition to its normal ones.
  *   Results are statically cached.
  */
-function taxonomy_get_tree($vid, $parent = 0, $depth = -1, $max_depth = NULL) {
+function taxonomy_get_tree($vid, $parent = 0, $depth = -1, $max_depth = NULL, $reset = FALSE) {
   static $children, $parents, $terms;
 
+  if ($reset) {
+    unset($children[$vid]);
+    unset($parents[$vid]);
+    unset($terms[$vid]);
+  }
+
   $depth++;
 
   // We cache trees, so it's not CPU-intensive to call get_tree() on a term
Index: modules/taxonomy/taxonomy.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.test,v
retrieving revision 1.8
diff -u -p -r1.8 taxonomy.test
--- modules/taxonomy/taxonomy.test	24 Sep 2008 18:42:00 -0000	1.8
+++ modules/taxonomy/taxonomy.test	24 Sep 2008 23:17:40 -0000
@@ -239,80 +239,89 @@ class TaxonomyTermFunctionsTestCase exte
   }
 }
 
-class TaxonomyTermSingleTestCase extends DrupalWebTestCase {
+class TaxonomyHierarchyTestCase extends DrupalWebTestCase {
 
   /**
    * Implementation of getInfo().
    */
   function getInfo() {
     return array(
-      'name' => t('Term single hierarchy'),
-      'description' => t('Testing save/update/delete terms in a single hierarchy.'),
+      'name' => t('Term hierarchy'),
+      'description' => t('Testing save/update/delete terms in hierarchical vocabularies.'),
       'group' => t('Taxonomy')
     );
   }
 
   /**
-   * Test single hierarchy terms.
+   * Test single hierarchy vocabularies.
    */
-  function testTermsFunctionsSingleHierarchy() {
-    // Preparing data: vocabulary hierarchy->single.
+  function testSingleHierarchy() {
     $edit = array();
-    $_t = array('vid', 'name', 'description', 'help', 'relations', 'hierarchy', 'multiple',
-        'required', 'tags', 'module', 'weight', 'nodes');
-    foreach($_t as $key ) {
+    $keys = array('vid', 'name', 'description', 'help', 'relations', 'hierarchy', 'multiple', 'required', 'tags', 'module', 'weight', 'nodes');
+    foreach($keys as $key ) {
       $edit[$key] = 0;
     }
 
-    // Create vocab.
-    $name = $this->randomName(20);
+    // Create vocabulary.
     $edit['hierarchy'] = 1;
-    $edit['name'] = $name;
+    $edit['name'] = $this->randomName();
     taxonomy_save_vocabulary($edit);
 
     // Create 1st term.
-    $termname = $this->randomName(20);
-    $data = array('name' => $termname, 'description' => '', 'weight' => 0, 'synonyms' => '', 'vid' => $edit['vid'], 'tid' => 0, 'relations' => 0);
-    taxonomy_save_term($data);
-    $_tArray = taxonomy_get_term_by_name($termname);
-    $parent = $_tArray[0];
+    $term1 = array('name' => $this->randomName(), 'description' => '', 'weight' => 0, 'synonyms' => '', 'vid' => $edit['vid'], 'tid' => 0, 'relations' => 0);
+    taxonomy_save_term($term1);
+    $matching_terms = taxonomy_get_term_by_name($term1['name']);
+    $parent = $matching_terms[0];
 
     // Create 2nd term as a child.
-    $termname = $this->randomName(20);
-    $data = array('name' => $termname, 'description' => '', 'weight' => 0, 'synonyms' => '', 'vid' => $edit['vid'], 'tid' => 0, 'relations' => 0, 'parent' => array($parent->tid));
-    taxonomy_save_term($data);
-    $_tArray = taxonomy_get_term_by_name($termname);
-    $children = $_tArray[0];
+    $term2 = array('name' => $this->randomName(), 'description' => '', 'weight' => 0, 'synonyms' => '', 'vid' => $edit['vid'], 'tid' => 0, 'relations' => 0, 'parent' => array($parent->tid));
+    taxonomy_save_term($term2);
+    $matching_terms = taxonomy_get_term_by_name($term2['name']);
+    $child = $matching_terms[0];
 
     // Check hierarchy.
-    $getChildren = taxonomy_get_children($parent->tid);
-    $getParent = taxonomy_get_parents($children->tid);
-    $this->assertEqual($parent,$getParent[$parent->tid], t('Checking parents.'));
-    $this->assertEqual($children,$getChildren[$children->tid], t('Checking children.'));
+    $term_ids = array($parent->tid, $child->tid);
+    $tree = taxonomy_get_tree($edit['vid']);
+    $tree_tids = array();
+    foreach ($tree AS $term) {
+      $tree_tids[] = $term->tid;
+    }
+    foreach ($term_ids AS $tid) {
+      $this->assertTrue(in_array($tid, $tree_tids), t('Term appears in tree.'));
+    }
+
+    $getChild = taxonomy_get_children($parent->tid);
+    $getParent = taxonomy_get_parents($child->tid);
+    $this->assertEqual($parent, $getParent[$parent->tid], t('Parents found.'));
+    $this->assertEqual($child, $getChild[$child->tid], t('Children found.'));
+
+    // Save 3rd term.
+    $term3 = $term1;
+    $term3['name'] = $this->randomName();
+    taxonomy_save_term($term3);
+    $matching_terms = taxonomy_get_term_by_name($term3['name']);
+    $child_2 = $matching_terms[0];
+
+    // Ensure the new term is in the tree.
+    $tree = taxonomy_get_tree($edit['vid']);
+    $found = FALSE;
+    foreach ($tree AS $term) {
+      if ($term->tid == $child_2->tid) {
+        $found = TRUE;
+        break;
+      }
+    }
+    $this->assertTrue($found, t('Newly added term was found in tree'));
 
     // Delete vocabulary.
     $edit['name'] = 0;
     taxonomy_save_vocabulary($edit);
   }
-}
-
-class TaxonomyTermMultipleTestCase extends DrupalWebTestCase {
-
-  /**
-   * Implementation of getInfo().
-   */
-  function getInfo() {
-    return array(
-      'name' => t('Term multiple hierarchy'),
-      'description' => t('Testing save/update/delete terms in a multiple hierarchy.'),
-      'group' => t('Taxonomy')
-    );
-  }
 
   /**
    * Test multiple hierarchy terms.
    */
-  function testTermsFunctionsMultipleHierarchy() {
+  function testMultipleHierarchy() {
     // Preparing data: vocabulary hierarchy->single.
     $edit = array();
     $_t = array('vid', 'name', 'description', 'help', 'relations', 'hierarchy', 'multiple',
