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.
49 lines
1.4 KiB
PHP
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);
|
|
}
|
|
}
|