/** * Returns the parent node of the current node or null when there is no parent. * * @return AbstractRenderNode|null */ public function getParent() { $unitMap = $this->relatedTree->getUnitMap(); $parentId = $this->getParentId(); if (isset($parentId)) { return $unitMap[$parentId]; } else { return null; } }
/** * @test * @group rendering * @group small * @group dev * * @expectedException \Render\Exceptions\NodeNotFoundException */ public function test_getNodeByUnitId_throwExceptionIfNodeNotExists() { // // ARRANGE // // Prepare module info storage $moduleInfo = $this->getModuleInfo(); $moduleInfoStorage = new ArrayBasedModuleInfoStorage($moduleInfo); $content = $this->getContent(); // // ACT // $nodeFactory = new Test1NodeFactory($moduleInfoStorage); $nodeTree = new NodeTree($content, $nodeFactory); // // ASSERT // $nodeTree->getNodeByUnitId('UNIT-NOT-EXIST-ID'); }