Spaces:
Runtime error
Runtime error
| namespace Tests\Unit; | |
| use App\Domain\Applications\ApplicationService; | |
| use ReflectionClass; | |
| use Tests\TestCase; | |
| class CalendlyWebhookDateTimeTest extends TestCase | |
| { | |
| public function test_calendly_iso_timestamp_is_normalized_for_database(): void | |
| { | |
| $this->assertSame( | |
| '2026-07-03 13:30:00', | |
| $this->normalize('2026-07-03T13:30:00.000000Z'), | |
| ); | |
| } | |
| public function test_invalid_calendly_timestamp_returns_null(): void | |
| { | |
| $this->assertNull($this->normalize('not-a-date')); | |
| } | |
| private function normalize(mixed $value): ?string | |
| { | |
| $reflection = new ReflectionClass(ApplicationService::class); | |
| $service = $reflection->newInstanceWithoutConstructor(); | |
| $method = $reflection->getMethod('calendlyDateTimeForDatabase'); | |
| $method->setAccessible(true); | |
| return $method->invoke($service, $value); | |
| } | |
| } | |