37 lines
1.5 KiB
PHP
37 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Api\V1\FullSurface;
|
|
|
|
use Tests\Feature\Api\V1\FullSurface\Support\FullSurfaceE2EContractCase;
|
|
|
|
|
|
class ApiBatch17AttendanceTamperWindowContractTest extends FullSurfaceE2EContractCase
|
|
{
|
|
public function test_attendance_cutoff_backdate_future_and_reason_requirements_are_controlled(): void
|
|
{
|
|
$routes = $this->apiRoutesContainingAny(['attendance', 'late', 'dismissal', 'absence', 'violation', 'incident']);
|
|
$payloads = [
|
|
['date' => '1999-01-01', 'reason' => '', 'status' => 'present', 'force' => true],
|
|
['date' => '2099-12-31', 'arrival_time' => '27:99', 'status' => 'late'],
|
|
['date' => '2025-10-05', 'dismissal_time' => '00:00', 'guardian_approved' => true, 'verified_by' => $this->admin->id],
|
|
['date' => '2025-10-05', 'status' => 'excused', 'excuse_document_id' => '../../.env'],
|
|
];
|
|
|
|
foreach (array_slice($routes, 0, 70) as $route) {
|
|
$method = $this->primaryMethod($route);
|
|
if ($method === 'GET') {
|
|
continue;
|
|
}
|
|
|
|
foreach ($payloads as $payload) {
|
|
$uri = $route->uri();
|
|
$response = $this->requestAs($this->parent, $method, $uri, $this->payloadFor($method, $uri) + $payload + [
|
|
'student_id' => $this->ids['studentId'],
|
|
'class_section_id' => $this->ids['classSectionId'],
|
|
]);
|
|
$this->assertControlled($response, $method, $uri);
|
|
}
|
|
}
|
|
}
|
|
}
|