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);
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);
174 $bool = $tree->isGrandChild(9,24);
175 $this->assertEquals($bool,1);
182 $bool = $tree->isDeleted(24);
183 $this->assertEquals($bool,
false);
185 $id = $tree->getParentId(24);
186 $this->assertEquals($id,14);
188 $lft = $tree->getLeftValue(24);
189 $this->assertEquals($lft,14);
191 $seq = $tree->getChildSequenceNumber($tree->getNodeData(24));
192 $this->assertEquals($seq,1);
194 $tree->getNodePath(9,1);
196 $max_depth = $tree->getMaximumDepth();
199 $tree =
new ilTree(ROOT_FOLDER_ID);
200 $suc = $tree->fetchSuccessorNode(16);
201 $cals = $tree->fetchPredecessorNode($suc[
'child']);
202 $this->assertEquals($cals[
'child'],16);