39 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
40 ilUnitUtil::performInitialisation();
46 $childs =
$tree->getChilds(14);
48 $this->assertEquals(count($childs), 1);
59 $childs =
$tree->getChildsByType(9,
'cals');
61 $this->assertEquals(count($childs), 1);
72 $childs =
$tree->getChildsByTypeFilter(9, array(
'cals',
'rolf'));
74 $this->assertEquals(count($childs), 2);
87 $childs =
$tree->getSubTree(
$root,
false,
'cals');
89 $this->assertEquals(count($childs), 1);
102 $this->assertTrue(
false,
"Testcase leads to fatal error.");
105 $ids =
$tree->getPathIdsUsingNestedSets(24, 9);
107 $this->assertEquals($ids, array(9,14,24));
110 $ids =
$tree->getPathIdsUsingNestedSets(24);
112 $this->assertEquals($ids, array(1,9,14,24));
125 $this->assertTrue(
false,
"Testcase leads to fatal error.");
128 $ids_ns =
$tree->getPathIdsUsingNestedSets(24);
129 $ids_al =
$tree->getPathIdsUsingAdjacencyMap(24);
131 $this->assertEquals($ids_ns, $ids_al);
154 $tree->getMaximumDepth();
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);
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();
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...
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