39 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
40 ilUnitUtil::performInitialisation();
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);
101 $tree =
new ilTree(ROOT_FOLDER_ID);
102 $ids = $tree->getPathIdsUsingNestedSets(24,9);
104 $this->assertEquals($ids,array(9,14,24));
106 $tree =
new ilTree(ROOT_FOLDER_ID);
107 $ids = $tree->getPathIdsUsingNestedSets(24);
109 $this->assertEquals($ids,array(1,9,14,24));
121 $tree =
new ilTree(ROOT_FOLDER_ID);
122 $ids_ns = $tree->getPathIdsUsingNestedSets(24);
123 $ids_al = $tree->getPathIdsUsingAdjacencyMap(24);
125 $this->assertEquals($ids_ns,$ids_al);
135 $tree =
new ilTree(ROOT_FOLDER_ID);
136 $res = $tree->getNodePath(1,29);
147 $tree =
new ilTree(ROOT_FOLDER_ID);
148 $tree->getMaximumDepth();
159 $tree =
new ilTree(ROOT_FOLDER_ID);
160 $d = $tree->getDepth(24);
162 $this->assertEquals(
$d,4);
164 $node = $tree->getNodeData(24);
165 $this->assertEquals($node[
'title'],
'Public chat');
167 $bool = $tree->isInTree(24);
168 $this->assertEquals($bool,
true);
170 $bool = $tree->isInTree(24242424);
171 $this->assertEquals($bool,
false);
178 $bool = $tree->isGrandChild(9,24);
179 $this->assertEquals($bool,1);
186 $bool = $tree->isDeleted(24);
187 $this->assertEquals($bool,
false);
189 $id = $tree->getParentId(24);
190 $this->assertEquals($id,14);
192 $lft = $tree->getLeftValue(24);
193 $this->assertEquals($lft,14);
195 $seq = $tree->getChildSequenceNumber($tree->getNodeData(24));
196 $this->assertEquals($seq,1);
198 $tree->getNodePath(9,1);
200 $max_depth = $tree->getMaximumDepth();
203 $tree =
new ilTree(ROOT_FOLDER_ID);
204 $suc = $tree->fetchSuccessorNode(16);
205 $cals = $tree->fetchPredecessorNode($suc[
'child']);
206 $this->assertEquals($cals[
'child'],16);