fedi-feed-router/backend/tests/Unit/Services/DashboardStatsServiceTest.php
2025-08-10 04:16:53 +02:00

42 lines
No EOL
1.2 KiB
PHP

<?php
namespace Tests\Unit\Services;
use App\Services\DashboardStatsService;
use Tests\TestCase;
use Illuminate\Support\Facades\Http;
class DashboardStatsServiceTest extends TestCase
{
protected function setUp(): void
{
parent::setUp();
// Mock HTTP requests to prevent external calls
Http::fake([
'*' => Http::response('', 500)
]);
}
public function test_get_available_periods_returns_correct_options(): void
{
$service = new DashboardStatsService();
$periods = $service->getAvailablePeriods();
$this->assertIsArray($periods);
$this->assertArrayHasKey('today', $periods);
$this->assertArrayHasKey('week', $periods);
$this->assertArrayHasKey('month', $periods);
$this->assertArrayHasKey('year', $periods);
$this->assertArrayHasKey('all', $periods);
$this->assertEquals('Today', $periods['today']);
$this->assertEquals('All Time', $periods['all']);
}
public function test_service_instantiation(): void
{
$service = new DashboardStatsService();
$this->assertInstanceOf(DashboardStatsService::class, $service);
}
}