Files
alrahma_sunday_school_api/tests/Feature/Api/V1/FullSurface/ApiBatch14CrossModuleInvariantRiskRegisterTest.php
T
2026-06-08 23:45:55 -04:00

39 lines
1.8 KiB
PHP

<?php
namespace Tests\Feature\Api\V1\FullSurface;
use Tests\Feature\Api\V1\FullSurface\Support\FullSurfaceE2EContractCase;
class ApiBatch14CrossModuleInvariantRiskRegisterTest extends FullSurfaceE2EContractCase
{
public function test_batch14_route_families_have_cross_module_risk_coverage(): void
{
$riskFamilies = [
'session-cookie-boundary' => ['auth', 'login', 'frontend'],
'identity-privacy' => ['password', 'verify', 'profile', 'me'],
'bulk-assignment' => ['assign', 'bulk', 'batch', 'class'],
'print-export-tamper' => ['print', 'export', 'download', 'certificate'],
'audit-tamper' => ['audit', 'log', 'activity'],
'finance-reconcile' => ['finance', 'payment', 'refund', 'ledger'],
'academic-rollback' => ['promotion', 'school-year', 'reopen'],
'kiosk-device' => ['attendance', 'scanner', 'badge'],
'notification-template' => ['notification', 'template', 'broadcast'],
'storage-signed-url' => ['file', 'media', 'signed', 'upload'],
];
foreach ($riskFamilies as $name => $needles) {
$this->assertNotEmpty($this->apiRoutesContainingAny($needles), 'Batch 14 expected route coverage for ' . $name);
}
}
public function test_batch14_high_risk_mutation_families_exist(): void
{
foreach (['users', 'students', 'attendance', 'finance', 'payment', 'roles', 'permissions', 'settings', 'messages', 'inventory'] as $family) {
$mutations = array_filter($this->apiRoutesContainingAny([$family]), function ($route): bool {
return in_array($this->primaryMethod($route), ['POST', 'PUT', 'PATCH', 'DELETE'], true);
});
$this->assertNotEmpty($mutations, 'Batch 14 expected mutating route family: ' . $family);
}
}
}