Files
alrahma_sunday_school_api/tests/Feature/Api/V1/FullSurface/ApiBatch18TwoPersonApprovalAndSegregationContractTest.php
T
2026-06-09 02:32:58 -04:00

42 lines
1.8 KiB
PHP

<?php
namespace Tests\Feature\Api\V1\FullSurface;
use Tests\Feature\Api\V1\FullSurface\Support\FullSurfaceE2EContractCase;
class ApiBatch18TwoPersonApprovalAndSegregationContractTest extends FullSurfaceE2EContractCase
{
public function test_batch18_twopersonapprovalandsegregation_stays_controlled(): void
{
$routes = $this->apiRoutesContainingAny(['approve', 'approval', 'review', 'refund', 'reimbursement', 'write-off', 'void', 'promotion', 'close', 'certificate']);
$payload = [
'approved' => true,
'approved_by' => 999999,
'reviewed_by' => 999999,
'second_approver_id' => 999999,
'skip_second_approval' => true,
'force_approve' => true,
];
foreach (array_slice($routes, 0, 100) as $route) {
$method = $this->primaryMethod($route);
$uri = $route->uri();
$actor = $this->actorFor($uri);
if (str_contains($uri, 'admin') || str_contains($uri, 'roles') || str_contains($uri, 'permissions')) {
$actor = $this->studentUser;
}
$response = $this->requestAs($actor, $method, $uri, $this->payloadFor($method, $uri) + $payload);
$this->assertControlled($response, $method, $uri);
$this->assertNotEquals(500, $response->getStatusCode(), $method.' '.$uri.' crashed during Batch 18 two-person approval and segregation of duties probe.');
$body = strtolower($response->getContent());
foreach (['sqlstate', 'stack trace', 'app_key', 'remember_token', 'api_token', 'massassignmentexception', 'foreign key constraint'] as $leak) {
$this->assertStringNotContainsString($leak, $body, $method.' '.$uri.' leaked '.$leak.' during Batch 18 two-person approval and segregation of duties probe.');
}
}
}
}