Files
alrahma_sunday_school_api/tests/Feature/Api/V1/FullSurface/ApiTimezoneCalendarRecurrenceDepthContractTest.php
T
root 8661615717
API CI/CD / Validate (composer + pint) (push) Successful in 2m46s
API CI/CD / Test (PHPUnit) (push) Failing after 3m3s
API CI/CD / Build frontend assets (push) Failing after 5m22s
API CI/CD / Security audit (push) Failing after 34s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
Update PHPUnit test metadata attributes
2026-06-25 20:04:18 -04:00

36 lines
1.4 KiB
PHP

<?php
namespace Tests\Feature\Api\V1\FullSurface;
use PHPUnit\Framework\Attributes\Test;
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.");
}
}
}
}