42 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
48 $tree =
new ilTree(ROOT_FOLDER_ID);
49 $childs = $tree->getChilds(14);
51 $this->assertEquals(count($childs),1);
61 $tree =
new ilTree(ROOT_FOLDER_ID);
62 $childs = $tree->getChildsByType(9,
'cals');
64 $this->assertEquals(count($childs),1);
74 $tree =
new ilTree(ROOT_FOLDER_ID);
75 $childs = $tree->getChildsByTypeFilter(9,array(
'cals',
'rolf'));
77 $this->assertEquals(count($childs),2);
87 $tree =
new ilTree(ROOT_FOLDER_ID);
89 $root = $tree->getNodeData(1);
90 $childs = $tree->getSubTree($root,
false,
'cals');
92 $this->assertEquals(count($childs),1);
103 $tree =
new ilTree(ROOT_FOLDER_ID);
104 $ids = $tree->getPathIdsUsingNestedSets(24,9);
106 $this->assertEquals($ids,array(9,14,24));
108 $tree =
new ilTree(ROOT_FOLDER_ID);
109 $ids = $tree->getPathIdsUsingNestedSets(24);
111 $this->assertEquals($ids,array(1,9,14,24));
122 $tree =
new ilTree(ROOT_FOLDER_ID);
123 $ids_ns = $tree->getPathIdsUsingNestedSets(24);
124 $ids_al = $tree->getPathIdsUsingAdjacencyMap(24);
126 $this->assertEquals($ids_ns,$ids_al);
136 $tree =
new ilTree(ROOT_FOLDER_ID);
137 $res = $tree->getNodePath(1,29);
147 $tree =
new ilTree(ROOT_FOLDER_ID);
148 $tree->getMaximumDepth();
158 $tree =
new ilTree(ROOT_FOLDER_ID);
159 $d = $tree->getDepth(24);
161 $this->assertEquals(
$d,4);
163 $node = $tree->getNodeData(24);
164 $this->assertEquals($node[
'title'],
'Public chat');
166 $bool = $tree->isInTree(24);
167 $this->assertEquals($bool,
true);
169 $bool = $tree->isInTree(24242424);
170 $this->assertEquals($bool,
false);
172 $node = $tree->getParentNodeData(24);
173 $this->assertEquals($node[
'title'],
'Chat-Server');
175 $bool = $tree->isGrandChild(9,24);
176 $this->assertEquals($bool,1);
178 $node = $tree->getNodeDataByType(
'chac');
179 $this->assertEquals($node[0][
'title'],
'Chat-Server');
181 $bool = $tree->isDeleted(24);
182 $this->assertEquals($bool,
false);
184 $id = $tree->getParentId(24);
185 $this->assertEquals($id,14);
187 $lft = $tree->getLeftValue(24);
188 $this->assertEquals($lft,14);
190 $seq = $tree->getChildSequenceNumber($tree->getNodeData(24));
191 $this->assertEquals($seq,1);
193 $tree->getNodePath(9,1);
195 $max_depth = $tree->getMaximumDepth();
198 $tree =
new ilTree(ROOT_FOLDER_ID);
199 $suc = $tree->fetchSuccessorNode(16);
200 $cals = $tree->fetchPredecessorNode($suc[
'child']);
201 $this->assertEquals($cals[
'child'],16);