39 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
45 $tree =
new ilTree(ROOT_FOLDER_ID);
46 $childs = $tree->getChilds(14);
48 $this->assertEquals(count($childs),1);
58 $tree =
new ilTree(ROOT_FOLDER_ID);
59 $childs = $tree->getChildsByType(9,
'cals');
61 $this->assertEquals(count($childs),1);
71 $tree =
new ilTree(ROOT_FOLDER_ID);
72 $childs = $tree->getChildsByTypeFilter(9,array(
'cals',
'rolf'));
74 $this->assertEquals(count($childs),2);
84 $tree =
new ilTree(ROOT_FOLDER_ID);
86 $root = $tree->getNodeData(1);
87 $childs = $tree->getSubTree($root,
false,
'cals');
89 $this->assertEquals(count($childs),1);
100 $tree =
new ilTree(ROOT_FOLDER_ID);
101 $ids = $tree->getPathIdsUsingNestedSets(24,9);
103 $this->assertEquals($ids,array(9,14,24));
105 $tree =
new ilTree(ROOT_FOLDER_ID);
106 $ids = $tree->getPathIdsUsingNestedSets(24);
108 $this->assertEquals($ids,array(1,9,14,24));
119 $tree =
new ilTree(ROOT_FOLDER_ID);
120 $ids_ns = $tree->getPathIdsUsingNestedSets(24);
121 $ids_al = $tree->getPathIdsUsingAdjacencyMap(24);
123 $this->assertEquals($ids_ns,$ids_al);
133 $tree =
new ilTree(ROOT_FOLDER_ID);
134 $res = $tree->getNodePath(1,29);
144 $tree =
new ilTree(ROOT_FOLDER_ID);
145 $tree->getMaximumDepth();
155 $tree =
new ilTree(ROOT_FOLDER_ID);
156 $d = $tree->getDepth(24);
158 $this->assertEquals(
$d,4);
160 $node = $tree->getNodeData(24);
161 $this->assertEquals($node[
'title'],
'Public chat');
163 $bool = $tree->isInTree(24);
164 $this->assertEquals($bool,
true);
166 $bool = $tree->isInTree(24242424);
167 $this->assertEquals($bool,
false);
169 $node = $tree->getParentNodeData(24);
170 $this->assertEquals($node[
'title'],
'Chat-Server');
172 $bool = $tree->isGrandChild(9,24);
173 $this->assertEquals($bool,1);
175 $node = $tree->getNodeDataByType(
'chac');
176 $this->assertEquals($node[0][
'title'],
'Chat-Server');
178 $bool = $tree->isDeleted(24);
179 $this->assertEquals($bool,
false);
181 $id = $tree->getParentId(24);
182 $this->assertEquals($id,14);
184 $lft = $tree->getLeftValue(24);
185 $this->assertEquals($lft,14);
187 $seq = $tree->getChildSequenceNumber($tree->getNodeData(24));
188 $this->assertEquals($seq,1);
190 $tree->getNodePath(9,1);
192 $max_depth = $tree->getMaximumDepth();
195 $tree =
new ilTree(ROOT_FOLDER_ID);
196 $suc = $tree->fetchSuccessorNode(16);
197 $cals = $tree->fetchPredecessorNode($suc[
'child']);
198 $this->assertEquals($cals[
'child'],16);