예제 #1
0
 public function itSetsTheParentNodeOfTheChildren()
 {
     $root = new TreeNode();
     $node_1 = new TreeNode();
     $node_2 = new TreeNode();
     $children = array($node_1, $node_2);
     $root->setChildren($children);
     $this->assertEqual($root, $node_2->getParentNode());
     $this->assertEqual($root, $node_1->getParentNode());
 }
 private function getParentNodeId(TreeNode $node)
 {
     $parent_node = $node->getParentNode();
     return $parent_node ? $parent_node->getId() : 0;
 }