DefaultAuthorizationManagerTest
extends BaseTestCase
in package
Activities\Services\DefaultAuthorizationManager Test Case
Tests the DefaultAuthorizationManager service including request, approve, deny, revoke, and retract workflows for activity authorizations.
Tags
Table of Contents
Constants
- TEST_ACTIVITY_ID = 1
- Test activity ID from seed data (Armored, id=1)
- TEST_SINGLE_APPROVAL_ACTIVITY_ID = 1
- Test activity that requires 1 approver
Properties
- $Activities : ActivitiesTable
- Activities table
- $authManager : DefaultAuthorizationManager|MockObject
- Service under test (mock with mailer stubbed)
- $AuthorizationApprovals : AuthorizationApprovalsTable
- AuthorizationApprovals table
- $Authorizations : AuthorizationsTable
- Authorizations table
- $Members : MembersTable
- Members table
Methods
- testApproveSingleApproverSuccess() : void
- Test approving a single-approver authorization completes the workflow
- testDenyAuthorizationSuccess() : void
- Test denying an authorization request
- testFullRequestApproveWorkflow() : void
- Test complete workflow: request → approve for single-approver activity
- testFullRequestDenyWorkflow() : void
- Test complete workflow: request → deny
- testRequestDuplicatePendingFails() : void
- Test duplicate pending request is rejected
- testRequestNewAuthorizationSuccess() : void
- Test creating a new authorization request succeeds
- testRequestRenewalWithoutExistingApprovedFails() : void
- Test renewal request without existing approved authorization fails
- testRetractByDifferentMemberFails() : void
- Test retracting by a different member fails
- testRetractNonExistentFails() : void
- Test retracting a non-existent authorization fails
- testRetractNonPendingFails() : void
- Test retracting a non-pending authorization fails
- testRetractPendingAuthorizationSuccess() : void
- Test retracting a pending authorization by the requester
- testRevokeApprovedAuthorizationSuccess() : void
- Test revoking an approved authorization
- setUp() : void
- setUp method
- tearDown() : void
- tearDown method
- createTestAuthorization() : Authorization, approval: mixed}
- Create a fresh authorization request for testing
- findMemberWithoutPending() : int
- Find a member ID that has no pending authorization for the given activity
Constants
TEST_ACTIVITY_ID
Test activity ID from seed data (Armored, id=1)
private
mixed
TEST_ACTIVITY_ID
= 1
TEST_SINGLE_APPROVAL_ACTIVITY_ID
Test activity that requires 1 approver
private
mixed
TEST_SINGLE_APPROVAL_ACTIVITY_ID
= 1
Properties
$Activities
Activities table
protected
ActivitiesTable
$Activities
$authManager
Service under test (mock with mailer stubbed)
protected
DefaultAuthorizationManager|MockObject
$authManager
$AuthorizationApprovals
AuthorizationApprovals table
protected
AuthorizationApprovalsTable
$AuthorizationApprovals
$Authorizations
Authorizations table
protected
AuthorizationsTable
$Authorizations
$Members
Members table
protected
MembersTable
$Members
Methods
testApproveSingleApproverSuccess()
Test approving a single-approver authorization completes the workflow
public
testApproveSingleApproverSuccess() : void
testDenyAuthorizationSuccess()
Test denying an authorization request
public
testDenyAuthorizationSuccess() : void
testFullRequestApproveWorkflow()
Test complete workflow: request → approve for single-approver activity
public
testFullRequestApproveWorkflow() : void
testFullRequestDenyWorkflow()
Test complete workflow: request → deny
public
testFullRequestDenyWorkflow() : void
testRequestDuplicatePendingFails()
Test duplicate pending request is rejected
public
testRequestDuplicatePendingFails() : void
testRequestNewAuthorizationSuccess()
Test creating a new authorization request succeeds
public
testRequestNewAuthorizationSuccess() : void
testRequestRenewalWithoutExistingApprovedFails()
Test renewal request without existing approved authorization fails
public
testRequestRenewalWithoutExistingApprovedFails() : void
testRetractByDifferentMemberFails()
Test retracting by a different member fails
public
testRetractByDifferentMemberFails() : void
testRetractNonExistentFails()
Test retracting a non-existent authorization fails
public
testRetractNonExistentFails() : void
testRetractNonPendingFails()
Test retracting a non-pending authorization fails
public
testRetractNonPendingFails() : void
testRetractPendingAuthorizationSuccess()
Test retracting a pending authorization by the requester
public
testRetractPendingAuthorizationSuccess() : void
testRevokeApprovedAuthorizationSuccess()
Test revoking an approved authorization
public
testRevokeApprovedAuthorizationSuccess() : void
setUp()
setUp method
protected
setUp() : void
tearDown()
tearDown method
protected
tearDown() : void
createTestAuthorization()
Create a fresh authorization request for testing
private
createTestAuthorization(int $requesterId, int $activityId, int $approverId) : Authorization, approval: mixed}
Parameters
- $requesterId : int
- $activityId : int
- $approverId : int
Return values
Authorization, approval: mixed}findMemberWithoutPending()
Find a member ID that has no pending authorization for the given activity
private
findMemberWithoutPending(int $activityId) : int
Parameters
- $activityId : int