ILIAS  eassessment Revision 61809
 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.

THIS IS CURRENTLY BROKEN as it makes reference to object types which have been torn out of the EA branch (warkusm, 2010-05-26)

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

Definition at line 36 of file ilTreeTest.php.

Member Function Documentation

ilTreeTest::setUp ( )
protected

Definition at line 40 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 156 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 46 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 59 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 72 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 134 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 120 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 101 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 85 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 145 of file ilTreeTest.php.

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

Field Documentation

ilTreeTest::$backupGlobals = FALSE
protected

Definition at line 38 of file ilTreeTest.php.


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