Open Journal Systems  3.3.0
PolicyTestCase Class Reference
Inheritance diagram for PolicyTestCase:
PKPTestCase AuthorizationDecisionManagerTest 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 ()
 
 mockRequest ($path='index/test-page/test-op', $userId=null)
 
 setTestConfiguration ($config, $configPath='config')
 
 setUp ()
 
 tearDown ()
 

Additional Inherited Members

- Data Fields inherited from PKPTestCase
 $mockedRegistryKeys = array()
 
 $registryBackup = array()
 

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

◆ getAuthorizationContextManipulationPolicy()

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 mockEffect(), AuthorizationDecisionManagerTest\testAuthorizationContext(), and RoleBasedHandlerOperationPolicyTest\testRoleAuthorization().

◆ getMockedRegistryKeys()

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.

Reimplemented from PKPTestCase.

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

◆ getMockRequest()

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 109 of file PolicyTestCase.inc.php.

References Registry\set().

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

◆ mockEffect()

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 87 of file PolicyTestCase.inc.php.

References getAuthorizationContextManipulationPolicy().

◆ mockGetContext()

PolicyTestCase::mockGetContext ( )

Callback used by PKPRouter created in getMockRequest().

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

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


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