ILIAS  Release_4_4_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 IL_Init.
 testRbacUA ()
 test rbac_ua IL_Init
 testRbacTA ()
 rbac ta test IL_Init
 testRbacPA ()
 test rbac_pa IL_Init
 testConditions ()
 test preconditions IL_Init
 testCache ()
 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 ilRBACTest.php.

Member Function Documentation

ilRBACTest::setUp ( )
protected

Definition at line 37 of file ilRBACTest.php.

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

IL_Init

Definition at line 179 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 IL_Init

Parameters
@return

Definition at line 143 of file ilRBACTest.php.

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

{
include_once './Services/AccessControl/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 IL_Init.

Parameters
@return

Definition at line 49 of file ilRBACTest.php.

{
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();
$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 IL_Init

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 IL_Init

Parameters
@return

Definition at line 107 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 IL_Init

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