Files
AndyTranscribe/tests/Feature/DiskSpaceTest.php
T
ben 771ee8db5a Add Docker stack, Reverb live progress, and duplicate upload detection.
Ship FrankenPHP Compose services with Reverb WebSockets for real-time transcription status, skip re-uploading identical audio via content hash, and format disk usage without requiring intl.
2026-08-12 17:35:48 +02:00

49 lines
1.4 KiB
PHP

<?php
namespace Tests\Feature;
use App\Services\DiskSpaceService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Cache;
use Tests\TestCase;
class DiskSpaceTest extends TestCase
{
use RefreshDatabase;
public function test_disk_space_service_returns_snapshot_for_storage_path(): void
{
Cache::flush();
$snapshot = app(DiskSpaceService::class)->snapshot();
$this->assertNotNull($snapshot);
$this->assertGreaterThan(0, $snapshot['total_bytes']);
$this->assertGreaterThanOrEqual(0, $snapshot['free_bytes']);
$this->assertGreaterThanOrEqual(0, $snapshot['used_percent']);
$this->assertLessThanOrEqual(100, $snapshot['used_percent']);
$this->assertNotEmpty($snapshot['free_human']);
$this->assertNotEmpty($snapshot['total_human']);
}
public function test_disk_space_service_returns_null_for_missing_path(): void
{
Cache::flush();
$snapshot = app(DiskSpaceService::class)->snapshot('/path/that/does/not/exist-'.uniqid());
$this->assertNull($snapshot);
}
public function test_layout_shows_disk_space_bar(): void
{
Cache::flush();
$this->get(route('recordings.index'))
->assertOk()
->assertSee('Disk space')
->assertSee('free')
->assertSee('role="progressbar"', false);
}
}