ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilTreeTest Class Reference

Unit tests for tree table. More...

+ Inheritance diagram for ilTreeTest:
+ Collaboration diagram for ilTreeTest:

Public Member Functions

 testGetChild ()
 
 testGetPathIdsUsingNestedSet ()
 get path ids using nested set IL_Init More...
 
 testGetPathIds ()
 get path ids (adjacenca and nested set) IL_Init More...
 
 testGetNodePath ()
 IL_Init More...
 
 testMaxDepth ()
 get path ids (adjacenca and nested set) IL_Init More...
 
 testAllOthers ()
 get path ids (adjacenca and nested set) IL_Init More...
 

Static Public Member Functions

 testGetChildsByType ()
 get childs by type IL_Init More...
 
 testGetChildsByTypeFilter ()
 get childs by type filter IL_Init More...
 
 testGetSubTree ()
 get childs by type filter IL_Init More...
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $backupGlobals = false
 

Detailed Description

Unit tests for tree table.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

needsInstalledILIAS

Definition at line 33 of file ilTreeTest.php.

Member Function Documentation

◆ setUp()

ilTreeTest::setUp ( )
protected

Definition at line 37 of file ilTreeTest.php.

38  {
39  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
40  ilUnitUtil::performInitialisation();
41  }

◆ testAllOthers()

ilTreeTest::testAllOthers ( )

get path ids (adjacenca and nested set) IL_Init

Parameters

Definition at line 163 of file ilTreeTest.php.

References $d, and $id.

164  {
165  $tree = new ilTree(ROOT_FOLDER_ID);
166  $d = $tree->getDepth(24);
167 
168  $this->assertEquals($d, 4);
169 
170  $node = $tree->getNodeData(24);
171  $this->assertEquals($node['title'], 'Public chat');
172 
173  $bool = $tree->isInTree(24);
174  $this->assertEquals($bool, true);
175 
176  $bool = $tree->isInTree(24242424);
177  $this->assertEquals($bool, false);
178 
179  /* ref_id 14 => obj_id 98 does not exist
180  $node = $tree->getParentNodeData(24);
181  $this->assertEquals($node['title'],'Chat-Server');
182  */
183 
184  $bool = $tree->isGrandChild(9, 24);
185  $this->assertEquals($bool, 1);
186 
187  /* see above
188  $node = $tree->getNodeDataByType('chac');
189  $this->assertEquals($node[0]['title'],'Chat-Server');
190  */
191 
192  $bool = $tree->isDeleted(24);
193  $this->assertEquals($bool, false);
194 
195  $id = $tree->getParentId(24);
196  $this->assertEquals($id, 14);
197 
198  $lft = $tree->getLeftValue(24);
199  $this->assertEquals($lft, 14);
200 
201  $seq = $tree->getChildSequenceNumber($tree->getNodeData(24));
202  $this->assertEquals($seq, 1);
203 
204  $tree->getNodePath(9, 1);
205 
206  $max_depth = $tree->getMaximumDepth();
207 
208  // Round trip
209  $tree = new ilTree(ROOT_FOLDER_ID);
210  $suc = $tree->fetchSuccessorNode(16); // cals
211  $cals = $tree->fetchPredecessorNode($suc['child']);
212  $this->assertEquals($cals['child'], 16);
213  }
if(!array_key_exists('StateId', $_REQUEST)) $id
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296

◆ testGetChild()

ilTreeTest::testGetChild ( )

Definition at line 43 of file ilTreeTest.php.

44  {
45  $tree = new ilTree(ROOT_FOLDER_ID);
46  $childs = $tree->getChilds(14); // Chat settings (contains public chat)
47 
48  $this->assertEquals(count($childs), 1);
49  }
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...

◆ testGetChildsByType()

ilTreeTest::testGetChildsByType ( )
static

get childs by type IL_Init

Definition at line 56 of file ilTreeTest.php.

57  {
58  $tree = new ilTree(ROOT_FOLDER_ID);
59  $childs = $tree->getChildsByType(9, 'cals'); // only calendar settings
60 
61  $this->assertEquals(count($childs), 1);
62  }
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...

◆ testGetChildsByTypeFilter()

ilTreeTest::testGetChildsByTypeFilter ( )
static

get childs by type filter IL_Init

Definition at line 69 of file ilTreeTest.php.

References array.

70  {
71  $tree = new ilTree(ROOT_FOLDER_ID);
72  $childs = $tree->getChildsByTypeFilter(9, array('cals','rolf')); // only calendar settings and role folder
73 
74  $this->assertEquals(count($childs), 2);
75  }
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.

◆ testGetNodePath()

ilTreeTest::testGetNodePath ( )

IL_Init

Parameters

Definition at line 139 of file ilTreeTest.php.

References $res.

140  {
141  $tree = new ilTree(ROOT_FOLDER_ID);
142  $res = $tree->getNodePath(1, 29);
143  }
foreach($_POST as $key=> $value) $res
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...

◆ testGetPathIds()

ilTreeTest::testGetPathIds ( )

get path ids (adjacenca and nested set) IL_Init

Parameters

Definition at line 121 of file ilTreeTest.php.

122  {
123  // This test leads to a fatal error, as getPathIdsUsingNestedSets and
124  // getPathIdsUsingAdjacencyMap are not defined on ilTree.
125  $this->assertTrue(false, "Testcase leads to fatal error.");
126 
127  $tree = new ilTree(ROOT_FOLDER_ID);
128  $ids_ns = $tree->getPathIdsUsingNestedSets(24);
129  $ids_al = $tree->getPathIdsUsingAdjacencyMap(24);
130 
131  $this->assertEquals($ids_ns, $ids_al);
132  }
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...

◆ testGetPathIdsUsingNestedSet()

ilTreeTest::testGetPathIdsUsingNestedSet ( )

get path ids using nested set IL_Init

Parameters

Definition at line 98 of file ilTreeTest.php.

References array.

99  {
100  // This test leads to a fatal error, as getPathIdsUsingNestedSets is
101  // not defined on ilTree.
102  $this->assertTrue(false, "Testcase leads to fatal error.");
103 
104  $tree = new ilTree(ROOT_FOLDER_ID);
105  $ids = $tree->getPathIdsUsingNestedSets(24, 9); // Administration -> Public Chat => should return 9,14,24 (chat server settings)
106 
107  $this->assertEquals($ids, array(9,14,24));
108 
109  $tree = new ilTree(ROOT_FOLDER_ID);
110  $ids = $tree->getPathIdsUsingNestedSets(24); // Administration -> Public Chat => should return 9,14,24 (chat server settings)
111 
112  $this->assertEquals($ids, array(1,9,14,24));
113  }
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.

◆ testGetSubTree()

ilTreeTest::testGetSubTree ( )
static

get childs by type filter IL_Init

Definition at line 82 of file ilTreeTest.php.

83  {
84  $tree = new ilTree(ROOT_FOLDER_ID);
85 
86  $root = $tree->getNodeData(1);
87  $childs = $tree->getSubTree($root, false, 'cals'); // only calendar settings
88 
89  $this->assertEquals(count($childs), 1);
90  }
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...

◆ testMaxDepth()

ilTreeTest::testMaxDepth ( )

get path ids (adjacenca and nested set) IL_Init

Parameters

Definition at line 151 of file ilTreeTest.php.

152  {
153  $tree = new ilTree(ROOT_FOLDER_ID);
154  $tree->getMaximumDepth();
155  }
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...

Field Documentation

◆ $backupGlobals

ilTreeTest::$backupGlobals = false
protected

Definition at line 35 of file ilTreeTest.php.


The documentation for this class was generated from the following file: