Files
alrahma_sunday_school_api/tests/Feature/Api/V1/FullSurface/ApiBatch17AcademicPrerequisiteAndDependencyContractTest.php
T
2026-06-09 01:25:14 -04:00

39 lines
1.5 KiB
PHP

<?php
namespace Tests\Feature\Api\V1\FullSurface;
use Tests\Feature\Api\V1\FullSurface\Support\FullSurfaceE2EContractCase;
class ApiBatch17AcademicPrerequisiteAndDependencyContractTest extends FullSurfaceE2EContractCase
{
public function test_academic_actions_do_not_skip_required_prerequisites_or_locks(): void
{
$routes = $this->apiRoutesContainingAny(['scores', 'grading', 'report-card', 'homework', 'quiz', 'project', 'midterm', 'final', 'promotion']);
$payload = [
'student_id' => $this->ids['studentId'],
'class_section_id' => $this->ids['classSectionId'],
'score' => 100,
'finalized' => true,
'locked' => false,
'teacher_approved' => true,
'admin_approved' => true,
'skip_missing_assignments' => true,
'force_publish' => true,
'override_prerequisites' => true,
];
foreach (array_slice($routes, 0, 90) as $route) {
$method = $this->primaryMethod($route);
if ($method === 'GET') {
continue;
}
$uri = $route->uri();
$response = $this->requestAs($this->teacher, $method, $uri, $this->payloadFor($method, $uri) + $payload);
$this->assertControlled($response, $method, $uri);
$body = strtolower($response->getContent());
$this->assertStringNotContainsString('sqlstate', $body, $method.' '.$uri.' leaked SQL on academic dependency probe.');
}
}
}