diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermUnitTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermUnitTest.php index 83132c3..3f0db8a 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermUnitTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermUnitTest.php @@ -104,5 +104,21 @@ function testTaxonomyVocabularyTree() { $this->assertEqual(2, $depth_count[1], 'Two elements in taxonomy tree depth 1.'); $this->assertEqual(2, $depth_count[2], 'Two elements in taxonomy tree depth 2.'); $this->assertEqual(1, $depth_count[3], 'One element in taxonomy tree depth 3.'); + + // Count parents of $term[2]. + $parents = taxonomy_term_load_parents($term[2]->id()); + $this->assertEqual(2, count($parents), 'The term has two parents.'); + + // Count parents of $term[3]. + $parents = taxonomy_term_load_parents($term[3]->id()); + $this->assertEqual(1, count($parents), 'The term has one parent.'); + + // Identify all ancestors of $term[2]. + $ancestors = taxonomy_term_load_parents_all($term[2]->id()); + $this->assertEqual(4, count($ancestors), 'The term has four ancestors including the term itself.'); + + // Identify all ancestors of $term[3]. + $ancestors = taxonomy_term_load_parents_all($term[3]->id()); + $this->assertEqual(5, count($ancestors), 'The term has five ancestors including the term itself.'); } }