ILIAS  Release_4_2_x_branch Revision 61807
 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
 testGetPathIds ()
 get path ids (adjacenca and nested set)
 testGetNodePath ()
 testMaxDepth ()
 get path ids (adjacenca and nested set)
 testAllOthers ()
 get path ids (adjacenca and nested set)

Static Public Member Functions

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

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.

References ilUnitUtil\performInitialisation().

{
include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
}

+ Here is the call graph for this function:

ilTreeTest::testAllOthers ( )

get path ids (adjacenca and nested set)

Parameters
@return

Definition at line 153 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);
$node = $tree->getParentNodeData(24);
$this->assertEquals($node['title'],'Chat-Server');
$bool = $tree->isGrandChild(9,24);
$this->assertEquals($bool,1);
$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

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

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 ( )
Parameters
@return

Definition at line 131 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)

Parameters
@return

Definition at line 117 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

Parameters
@return

Definition at line 98 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

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)

Parameters
@return

Definition at line 142 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: