fedi-feed-router/tests/Unit/Services/SystemStatusServiceTest.php

44 lines
1.3 KiB
PHP
Raw Normal View History

2025-08-06 21:49:13 +02:00
<?php
namespace Tests\Unit\Services;
use App\Services\SystemStatusService;
use Tests\TestCase;
2025-08-10 04:16:53 +02:00
use Illuminate\Support\Facades\Http;
2025-08-06 21:49:13 +02:00
class SystemStatusServiceTest extends TestCase
{
protected function setUp(): void
{
parent::setUp();
2025-08-10 04:16:53 +02:00
// Mock HTTP requests to prevent external calls
Http::fake([
'*' => Http::response('', 500)
]);
2025-08-06 21:49:13 +02:00
}
2025-08-10 04:16:53 +02:00
public function test_service_instantiation(): void
2025-08-06 21:49:13 +02:00
{
2025-08-10 04:16:53 +02:00
$service = new SystemStatusService();
$this->assertInstanceOf(SystemStatusService::class, $service);
}
2025-08-06 21:49:13 +02:00
2025-08-10 04:16:53 +02:00
public function test_get_system_status_returns_correct_structure(): void
{
$service = new SystemStatusService();
$status = $service->getSystemStatus();
2025-08-06 21:49:13 +02:00
$this->assertIsArray($status);
$this->assertArrayHasKey('is_enabled', $status);
$this->assertArrayHasKey('status', $status);
$this->assertArrayHasKey('status_class', $status);
$this->assertArrayHasKey('reasons', $status);
2025-08-10 04:16:53 +02:00
// Without database setup, system should be disabled
2025-08-06 21:49:13 +02:00
$this->assertFalse($status['is_enabled']);
$this->assertEquals('Disabled', $status['status']);
$this->assertEquals('text-red-600', $status['status_class']);
2025-08-10 04:16:53 +02:00
$this->assertIsArray($status['reasons']);
2025-08-06 21:49:13 +02:00
}
}