Intégration reservations et mock lavage

This commit is contained in:
bastien
2026-07-03 19:01:49 +02:00
parent b2443b654c
commit 55a558b536
16 changed files with 346 additions and 5 deletions
+59
View File
@@ -0,0 +1,59 @@
<?php
namespace Tests\Feature\Api;
use Illuminate\Support\Facades\DB;
use Tests\TestCase;
class HealthTest extends TestCase
{
public function test_health_endpoint_returns_api_status(): void
{
$response = $this->getJson('/api/v1/health');
$response->assertOk()
->assertJson([
'success' => true,
'data' => [
'status' => 'ok',
'service' => 'laverie-api',
],
])
->assertJsonStructure([
'data' => ['timestamp'],
]);
}
public function test_database_health_endpoint_returns_ok_when_connected(): void
{
$response = $this->getJson('/api/v1/health/db');
$response->assertOk()
->assertJson([
'success' => true,
'data' => [
'status' => 'ok',
'database' => 'sqlite',
],
]);
}
public function test_database_health_endpoint_returns_service_unavailable_when_disconnected(): void
{
DB::shouldReceive('select')
->once()
->with('SELECT 1')
->andThrow(new \RuntimeException('Connection refused'));
$response = $this->getJson('/api/v1/health/db');
$response->assertStatus(503)
->assertJson([
'success' => false,
'message' => 'Database connection failed',
'errors' => [
'database' => ['Connection unavailable'],
],
]);
}
}