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);
102 $this->assertTrue(
false,
"Testcase leads to fatal error.");
104 $tree =
new ilTree(ROOT_FOLDER_ID);
105 $ids = $tree->getPathIdsUsingNestedSets(24, 9);
107 $this->assertEquals($ids,
array(9,14,24));
109 $tree =
new ilTree(ROOT_FOLDER_ID);
110 $ids = $tree->getPathIdsUsingNestedSets(24);
112 $this->assertEquals($ids,
array(1,9,14,24));
125 $this->assertTrue(
false,
"Testcase leads to fatal error.");
127 $tree =
new ilTree(ROOT_FOLDER_ID);
128 $ids_ns = $tree->getPathIdsUsingNestedSets(24);
129 $ids_al = $tree->getPathIdsUsingAdjacencyMap(24);
131 $this->assertEquals($ids_ns, $ids_al);
141 $tree =
new ilTree(ROOT_FOLDER_ID);
142 $res = $tree->getNodePath(1, 29);
153 $tree =
new ilTree(ROOT_FOLDER_ID);
154 $tree->getMaximumDepth();
165 $tree =
new ilTree(ROOT_FOLDER_ID);
166 $d = $tree->getDepth(24);
168 $this->assertEquals(
$d, 4);
170 $node = $tree->getNodeData(24);
171 $this->assertEquals($node[
'title'],
'Public chat');
173 $bool = $tree->isInTree(24);
174 $this->assertEquals($bool,
true);
176 $bool = $tree->isInTree(24242424);
177 $this->assertEquals($bool,
false);
184 $bool = $tree->isGrandChild(9, 24);
185 $this->assertEquals($bool, 1);
192 $bool = $tree->isDeleted(24);
193 $this->assertEquals($bool,
false);
195 $id = $tree->getParentId(24);
196 $this->assertEquals(
$id, 14);
198 $lft = $tree->getLeftValue(24);
199 $this->assertEquals($lft, 14);
201 $seq = $tree->getChildSequenceNumber($tree->getNodeData(24));
202 $this->assertEquals($seq, 1);
204 $tree->getNodePath(9, 1);
206 $max_depth = $tree->getMaximumDepth();
209 $tree =
new ilTree(ROOT_FOLDER_ID);
210 $suc = $tree->fetchSuccessorNode(16);
211 $cals = $tree->fetchPredecessorNode($suc[
'child']);
212 $this->assertEquals($cals[
'child'], 16);
if(!array_key_exists('StateId', $_REQUEST)) $id
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
foreach($_POST as $key=> $value) $res
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...
Create styles array
The data for the language used.
testMaxDepth()
get path ids (adjacenca and nested set) IL_Init
Unit tests for tree table.
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d