diff --git a/app/Http/Controllers/HealthController.php b/app/Http/Controllers/HealthController.php new file mode 100644 index 000000000..3cdd8f6d8 --- /dev/null +++ b/app/Http/Controllers/HealthController.php @@ -0,0 +1,24 @@ +json($status); + } +} diff --git a/routes/web.php b/routes/web.php index aa8b118b4..5949d587e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,5 +1,6 @@ middleware(['auth']) ->name('users.destroy'); +Route::get('/health', [HealthController::class, 'show'])->name('health'); + require __DIR__.'/admin.php'; require __DIR__.'/block-list.php'; require __DIR__.'/individuals.php'; diff --git a/tests/Feature/HealthTest.php b/tests/Feature/HealthTest.php new file mode 100644 index 000000000..ea1719803 --- /dev/null +++ b/tests/Feature/HealthTest.php @@ -0,0 +1,21 @@ +assertOk() + ->assertJson(fn (AssertableJson $json) => $json->missing('duration') + ); +}); + +test('health page loads with response', function () { + define('LARAVEL_START', microtime(true)); + + get(route('health')) + ->assertOk() + ->assertJson(fn (AssertableJson $json) => $json->has('duration') + ); +});