/** * Transform the parent * * @param \Puml\Model\Object $child The direct child of the parent * * @return void * @since 0.1 * @throws Exception */ protected function transformParent(\Puml\Model\Object $child) { if (!$child->hasParent()) { throw new \Exception('Unable to transform parent, when no parent available, on class ' . $child->getName()); } $this->level++; $parent = $child->getParent(); $this->transformObject($parent); $edge = new Edge($this->graph->findNode($child->getName()), $this->graph->findNode($parent->getName())); $edge->setArrowhead('empty'); $this->graph->link($edge); if ($parent->hasParent()) { $this->transformParent($parent); } }
/** * @covers Puml\Model\Object::getParent */ public function testGetParent() { $parent = $this->getMock(get_class($this->object)); $this->object->setParent($parent); $this->assertSame($parent, $this->object->getParent()); }