ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilRBACTest Class Reference

Unit tests for tree table. More...

+ Inheritance diagram for ilRBACTest:
+ Collaboration diagram for ilRBACTest:

Public Member Functions

 testRbacFA ()
 RBAC FA tests.
 testRbacUA ()
 test rbac_ua
 testRbacTA ()
 rbac ta test
 testRbacPA ()
 test rbac_pa
 testConditions ()
 test preconditions
 testCache ()

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 ilRBACTest.php.

Member Function Documentation

ilRBACTest::setUp ( )
protected

Definition at line 37 of file ilRBACTest.php.

References ilUnitUtil\performInitialisation().

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

+ Here is the call graph for this function:

ilRBACTest::testCache ( )

Definition at line 175 of file ilRBACTest.php.

References $res.

{
include_once './Services/AccessControl/classes/class.ilAccessHandler.php';
$handler = new ilAccessHandler();
$handler->setResults(array(1,2,3));
$handler->storeCache();
$handler->readCache();
$res = $handler->getResults();
$this->assertEquals(array(1,2,3),$res);
}
ilRBACTest::testConditions ( )

test preconditions

Parameters
@return

Definition at line 142 of file ilRBACTest.php.

References ilConditionHandler\_deleteTargetConditionsByRefId(), ilConditionHandler\_getCondition(), ilConditionHandler\_getConditionsOfTarget(), ilConditionHandler\_getConditionsOfTrigger(), and ilConditionHandler\_getDistinctTargetRefIds().

{
include_once './classes/class.ilConditionHandler.php';
$handler = new ilConditionHandler();
$handler->setTargetRefId(99999);
$handler->setTargetObjId(99998);
$handler->setTargetType('xxx');
$handler->setTriggerRefId(99997);
$handler->setTriggerObjId(99996);
$handler->setTriggerType('yyy');
$handler->setReferenceHandlingType(0);
$handler->enableAutomaticValidation(false);
$suc = $handler->storeCondition();
$this->assertEquals($suc,true);
$suc = $handler->checkExists();
$this->assertEquals($suc,false);
$suc = $handler->delete(99999);
$this->assertEquals($suc,true);
// syntax check
$handler->deleteByObjId(-1);
$handler->deleteCondition(-1);
}

+ Here is the call graph for this function:

ilRBACTest::testRbacFA ( )

RBAC FA tests.

Parameters
@return

Definition at line 48 of file ilRBACTest.php.

References $empty.

{
global $rbacreview,$rbacadmin;
// Non empty
$non_empty = $rbacreview->filterEmptyRoleFolders(array(8));
$this->assertEquals($non_empty,array(8));
// Empty
$empty = $rbacreview->filterEmptyRoleFolders(array(1));
$this->assertEquals($empty,array());
// Protected
$rbacadmin->setProtected(1,4,'y');
$prot = $rbacreview->isProtected(8,4);
$this->assertEquals($prot,true);
$rbacadmin->setProtected(1,4,'n');
$prot = $rbacreview->isProtected(8,4);
$this->assertEquals($prot,false);
$rbacreview->getRoleListByObject(8);
$rbacreview->getAssignableRoles();
// Child roles
$child1 = $rbacreview->getAssignableRolesInSubtree(8);
$child2 = $rbacreview->getAssignableChildRoles(8);
$this->assertEquals($child1,$child2);
$ass = $rbacreview->isAssignable(4,8);
$this->assertEquals($ass,true);
$roles = $rbacreview->getRolesOfRoleFolder(8);
$rbacreview->__getAllRoleFolderIds();
$rbacreview->getLinkedRolesOfRoleFolder(8);
$obj = $rbacreview->getObjectOfRole(4);
$this->assertEquals(9,$obj);
$rbacreview->getRolesForIDs(array(4),false);
}
ilRBACTest::testRbacPA ( )

test rbac_pa

Definition at line 126 of file ilRBACTest.php.

{
global $rbacreview,$rbacadmin;
$sess_ops = $rbacreview->getOperationsOnTypeString('cat');
$rbacadmin->revokePermission(1,4);
$rbacadmin->grantPermission(4,array(2,3),1);
}
ilRBACTest::testRbacTA ( )

rbac ta test

Parameters
@return

Definition at line 108 of file ilRBACTest.php.

{
global $rbacreview,$rbacadmin;
$sess_ops = $rbacreview->getOperationsOnTypeString('sess');
$rbacadmin->assignOperationToObject($rbacreview->getTypeId('sess'),'7');
//$new_sess_ops = $rbacreview->getOperationsOnTypeString('sess');
//$this->assertEquals(array_merge($sess_ops,array(7)),$new_sess_ops);
$rbacadmin->deassignOperationFromObject($rbacreview->getTypeId('sess'),'7');
$new_sess_ops = $rbacreview->getOperationsOnTypeString('sess');
$this->assertEquals($sess_ops,$new_sess_ops);
}
ilRBACTest::testRbacUA ( )

test rbac_ua

Definition at line 93 of file ilRBACTest.php.

References ilUtil\_getObjectsByOperations().

{
global $rbacreview,$rbacadmin;
$obj = ilUtil::_getObjectsByOperations('crs','join');
$rbacreview->assignedUsers(4);
$rbacreview->assignedRoles(6);
}

+ Here is the call graph for this function:

Field Documentation

ilRBACTest::$backupGlobals = FALSE
protected

Definition at line 35 of file ilRBACTest.php.


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