function it_returns_an_array_of_with_a_single_parent_taxon(TaxonInterface $parentTaxon) { $parentTaxon->getParent()->willReturn(null); $parentTaxon->addChild($this)->shouldBeCalled(); $this->setParent($parentTaxon); $this->getParents()->shouldReturn([$parentTaxon]); }
/** * {@inheritdoc} */ public function setParent(TaxonInterface $parent = null) { $this->parent = $parent; if (null !== $parent) { $parent->addChild($this); } }
/** * {@inheritdoc} */ public function addTaxon(TaxonInterface $taxon) { $this->root->addChild($taxon); }