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);
103 $this->assertTrue(
false,
"Testcase leads to fatal error.");
105 $tree =
new ilTree(ROOT_FOLDER_ID);
106 $ids = $tree->getPathIdsUsingNestedSets(24,9);
108 $this->assertEquals($ids,array(9,14,24));
110 $tree =
new ilTree(ROOT_FOLDER_ID);
111 $ids = $tree->getPathIdsUsingNestedSets(24);
113 $this->assertEquals($ids,array(1,9,14,24));
126 $this->assertTrue(
false,
"Testcase leads to fatal error.");
128 $tree =
new ilTree(ROOT_FOLDER_ID);
129 $ids_ns = $tree->getPathIdsUsingNestedSets(24);
130 $ids_al = $tree->getPathIdsUsingAdjacencyMap(24);
132 $this->assertEquals($ids_ns,$ids_al);
142 $tree =
new ilTree(ROOT_FOLDER_ID);
143 $res = $tree->getNodePath(1,29);
154 $tree =
new ilTree(ROOT_FOLDER_ID);
155 $tree->getMaximumDepth();
166 $tree =
new ilTree(ROOT_FOLDER_ID);
167 $d = $tree->getDepth(24);
169 $this->assertEquals(
$d,4);
171 $node = $tree->getNodeData(24);
172 $this->assertEquals($node[
'title'],
'Public chat');
174 $bool = $tree->isInTree(24);
175 $this->assertEquals($bool,
true);
177 $bool = $tree->isInTree(24242424);
178 $this->assertEquals($bool,
false);
185 $bool = $tree->isGrandChild(9,24);
186 $this->assertEquals($bool,1);
193 $bool = $tree->isDeleted(24);
194 $this->assertEquals($bool,
false);
196 $id = $tree->getParentId(24);
197 $this->assertEquals($id,14);
199 $lft = $tree->getLeftValue(24);
200 $this->assertEquals($lft,14);
202 $seq = $tree->getChildSequenceNumber($tree->getNodeData(24));
203 $this->assertEquals($seq,1);
205 $tree->getNodePath(9,1);
207 $max_depth = $tree->getMaximumDepth();
210 $tree =
new ilTree(ROOT_FOLDER_ID);
211 $suc = $tree->fetchSuccessorNode(16);
212 $cals = $tree->fetchPredecessorNode($suc[
'child']);
213 $this->assertEquals($cals[
'child'],16);
testAllOthers()
get path ids (adjacenca and nested set) IL_Init
testGetChildsByType()
get childs by type IL_Init
testGetSubTree()
get childs by type filter IL_Init
testGetPathIdsUsingNestedSet()
get path ids using nested set IL_Init
testGetPathIds()
get path ids (adjacenca and nested set) IL_Init
testGetChildsByTypeFilter()
get childs by type filter IL_Init
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
testMaxDepth()
get path ids (adjacenca and nested set) IL_Init
Unit tests for tree table.