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

35 lines
1.4 KiB
PHP

<?php
namespace Tests\Feature\Api\V1\FullSurface;
use Tests\Feature\Api\V1\FullSurface\Support\FullSurfaceE2EContractCase;
class ApiTimezoneCalendarRecurrenceDepthContractTest extends FullSurfaceE2EContractCase
{
/** @test */
public function calendar_and_schedule_routes_reject_ambiguous_recurrence_and_timezone_inputs_cleanly(): void
{
$routes = array_slice($this->apiRoutesContainingAny(['calendar', 'schedule', 'event', 'school-year', 'semester']), 0, 80);
$payloads = [
['date' => '2025-03-09', 'time' => '02:30', 'timezone' => 'America/New_York'],
['starts_at' => '2025-11-02T01:30:00', 'ends_at' => '2025-11-02T01:15:00', 'timezone' => 'America/New_York'],
['rrule' => 'FREQ=SECONDLY;INTERVAL=1;COUNT=999999'],
['rrule' => 'FREQ=DAILY;UNTIL=not-a-date'],
['timezone' => '../../UTC', 'date' => 'not-a-date'],
];
foreach ($routes as $route) {
$method = $this->primaryMethod($route);
$uri = $route->uri();
foreach ($payloads as $payload) {
$response = $this->requestAs($this->actorFor($uri), $method, $uri, $this->payloadFor($method, $uri) + $payload);
$this->assertControlled($response, $method, $uri);
$this->assertLessThan(500, $response->getStatusCode(), "$method $uri should not crash on calendar edge cases.");
}
}
}
}