ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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
 testGetPathIds ()
 get path ids (adjacenca and nested set) IL_Init
 testGetNodePath ()
 IL_Init
 testMaxDepth ()
 get path ids (adjacenca and nested set) IL_Init
 testAllOthers ()
 get path ids (adjacenca and nested set) IL_Init

Static Public Member Functions

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

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$

Definition at line 33 of file ilTreeTest.php.

Member Function Documentation

ilTreeTest::setUp ( )
protected

Definition at line 37 of file ilTreeTest.php.

{
include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
ilUnitUtil::performInitialisation();
}
ilTreeTest::testAllOthers ( )

get path ids (adjacenca and nested set) IL_Init

Parameters
@return

Definition at line 157 of file ilTreeTest.php.

References $d.

{
$tree = new ilTree(ROOT_FOLDER_ID);
$d = $tree->getDepth(24);
$this->assertEquals($d,4);
$node = $tree->getNodeData(24);
$this->assertEquals($node['title'],'Public chat');
$bool = $tree->isInTree(24);
$this->assertEquals($bool,true);
$bool = $tree->isInTree(24242424);
$this->assertEquals($bool,false);
/* ref_id 14 => obj_id 98 does not exist
$node = $tree->getParentNodeData(24);
$this->assertEquals($node['title'],'Chat-Server');
*/
$bool = $tree->isGrandChild(9,24);
$this->assertEquals($bool,1);
/* see above
$node = $tree->getNodeDataByType('chac');
$this->assertEquals($node[0]['title'],'Chat-Server');
*/
$bool = $tree->isDeleted(24);
$this->assertEquals($bool,false);
$id = $tree->getParentId(24);
$this->assertEquals($id,14);
$lft = $tree->getLeftValue(24);
$this->assertEquals($lft,14);
$seq = $tree->getChildSequenceNumber($tree->getNodeData(24));
$this->assertEquals($seq,1);
$tree->getNodePath(9,1);
$max_depth = $tree->getMaximumDepth();
// Round trip
$tree = new ilTree(ROOT_FOLDER_ID);
$suc = $tree->fetchSuccessorNode(16); // cals
$cals = $tree->fetchPredecessorNode($suc['child']);
$this->assertEquals($cals['child'],16);
}
ilTreeTest::testGetChild ( )

Definition at line 43 of file ilTreeTest.php.

{
$tree = new ilTree(ROOT_FOLDER_ID);
$childs = $tree->getChilds(14); // Chat settings (contains public chat)
$this->assertEquals(count($childs),1);
}
ilTreeTest::testGetChildsByType ( )
static

get childs by type IL_Init

Definition at line 56 of file ilTreeTest.php.

{
$tree = new ilTree(ROOT_FOLDER_ID);
$childs = $tree->getChildsByType(9,'cals'); // only calendar settings
$this->assertEquals(count($childs),1);
}
ilTreeTest::testGetChildsByTypeFilter ( )
static

get childs by type filter IL_Init

Definition at line 69 of file ilTreeTest.php.

{
$tree = new ilTree(ROOT_FOLDER_ID);
$childs = $tree->getChildsByTypeFilter(9,array('cals','rolf')); // only calendar settings and role folder
$this->assertEquals(count($childs),2);
}
ilTreeTest::testGetNodePath ( )

IL_Init

Parameters
@return

Definition at line 133 of file ilTreeTest.php.

References $res.

{
$tree = new ilTree(ROOT_FOLDER_ID);
$res = $tree->getNodePath(1,29);
}
ilTreeTest::testGetPathIds ( )

get path ids (adjacenca and nested set) IL_Init

Parameters
@return

Definition at line 119 of file ilTreeTest.php.

{
$tree = new ilTree(ROOT_FOLDER_ID);
$ids_ns = $tree->getPathIdsUsingNestedSets(24);
$ids_al = $tree->getPathIdsUsingAdjacencyMap(24);
$this->assertEquals($ids_ns,$ids_al);
}
ilTreeTest::testGetPathIdsUsingNestedSet ( )

get path ids using nested set IL_Init

Parameters
@return

Definition at line 99 of file ilTreeTest.php.

{
$tree = new ilTree(ROOT_FOLDER_ID);
$ids = $tree->getPathIdsUsingNestedSets(24,9); // Administration -> Public Chat => should return 9,14,24 (chat server settings)
$this->assertEquals($ids,array(9,14,24));
$tree = new ilTree(ROOT_FOLDER_ID);
$ids = $tree->getPathIdsUsingNestedSets(24); // Administration -> Public Chat => should return 9,14,24 (chat server settings)
$this->assertEquals($ids,array(1,9,14,24));
}
ilTreeTest::testGetSubTree ( )
static

get childs by type filter IL_Init

Definition at line 82 of file ilTreeTest.php.

{
$tree = new ilTree(ROOT_FOLDER_ID);
$root = $tree->getNodeData(1);
$childs = $tree->getSubTree($root,false,'cals'); // only calendar settings
$this->assertEquals(count($childs),1);
}
ilTreeTest::testMaxDepth ( )

get path ids (adjacenca and nested set) IL_Init

Parameters
@return

Definition at line 145 of file ilTreeTest.php.

{
$tree = new ilTree(ROOT_FOLDER_ID);
$tree->getMaximumDepth();
}

Field Documentation

ilTreeTest::$backupGlobals = FALSE
protected

Definition at line 35 of file ilTreeTest.php.


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