diff --git a/tests/src/Kernel/Processor/AddHierarchyTest.php b/tests/src/Kernel/Processor/AddHierarchyTest.php index 2f1a6d7..d9a52f7 100644 --- a/tests/src/Kernel/Processor/AddHierarchyTest.php +++ b/tests/src/Kernel/Processor/AddHierarchyTest.php @@ -211,6 +211,33 @@ public function testPreprocessIndexItemsTaxonomy() { $result = $query->execute(); $expected = array('node' => array(0)); $this->assertResults($result, $expected); + + // Also add a term with multiple parents. + $this->terms['avocado'] = $this->createTerm($this->vocabulary, array( + 'name' => 'Avocado', + 'parent' => array($this->terms['fruit']->id(), $this->terms['vegetable']->id()), + )); + $this->nodes[3] = $this->createNode(array( + 'type' => 'page', + 'term_field' => array( + 'target_id' => $this->terms['avocado']->id(), + ), + )); + $this->index->reindex(); + $this->index->indexItems(); + + // Searching for 'fruit' or 'vegetable' should return this new node. + $query = new Query($this->index); + $query->addCondition('term_field', $this->terms['fruit']->id()); + $result = $query->execute(); + $expected = array('node' => array(2, 3)); + $this->assertResults($result, $expected); + + $query = new Query($this->index); + $query->addCondition('term_field', $this->terms['vegetable']->id()); + $result = $query->execute(); + $expected = array('node' => array(0, 1, 3)); + $this->assertResults($result, $expected); } /**