Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
PolicyTestCase Class Reference
Inheritance diagram for PolicyTestCase:
PKPTestCase AuthorizationDecisionManagerTest PKPProcessAccessPolicyTest PKPPublicAccessPolicyTest RoleBasedHandlerOperationPolicyTest

Public Member Functions

 mockEffect ()
 
 mockGetContext ()
 
- Public Member Functions inherited from PKPTestCase
 getActualOutput ()
 

Protected Member Functions

 getAuthorizationContextManipulationPolicy ()
 
 getMockedRegistryKeys ()
 
 getMockRequest ($requestedOp, $context=null, $user=null)
 
- Protected Member Functions inherited from PKPTestCase
 getMockedDAOs ()
 
 getMockedRegistryKeys ()
 
 mockRequest ($path= 'index/test-page/test-op', $userId=null)
 
 setTestConfiguration ($config, $configPath= 'config')
 
 setUp ()
 
 tearDown ()
 

Detailed Description

Abstract base test class that provides infrastructure for several types of policy tests.

See Also
RoleBasedHandlerOperation

Definition at line 24 of file PolicyTestCase.inc.php.

Member Function Documentation

PolicyTestCase::getAuthorizationContextManipulationPolicy ( )
protected

Create an authorization context manipulation policy.

Returns
$testPolicy AuthorizationPolicy the policy that will be used by the decision manager to call this mock method.

Definition at line 67 of file PolicyTestCase.inc.php.

Referenced by AuthorizationDecisionManagerTest\testAuthorizationContext(), and RoleBasedHandlerOperationPolicyTest\testRoleAuthorization().

PolicyTestCase::getMockedRegistryKeys ( )
protected

Override this method if you want to backup/restore registry entries before/after the test.

Returns
array A list of registry keys to backup and restore.

Definition at line 40 of file PolicyTestCase.inc.php.

PolicyTestCase::getMockRequest (   $requestedOp,
  $context = null,
  $user = null 
)
protected

Instantiate a mock request to the given operation.

Parameters
$requestedOpstring the requested operation
$contextarray request context object(s) to be returned by the router.
$userUser a user to be put into the registry.
Returns
PKPRequest

Definition at line 107 of file PolicyTestCase.inc.php.

Referenced by PKPProcessAccessPolicyTest\testPKPProcessAccessPolicy(), PKPPublicAccessPolicyTest\testPKPPublicAccessPolicy(), and RoleBasedHandlerOperationPolicyTest\testRoleAuthorization().

PolicyTestCase::mockEffect ( )

Callback method that will be called in place of the effect() method of a mock policy.

Returns
integer AUTHORIZATION_PERMIT

Definition at line 85 of file PolicyTestCase.inc.php.

PolicyTestCase::mockGetContext ( )

Callback used by PKPRouter created in getMockRequest().

See Also
PKPRouter::getContext()
Returns
mixed Context object or null

Definition at line 142 of file PolicyTestCase.inc.php.


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