2022-09-14 12:12:06 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Unit\Services;
|
|
|
|
|
|
|
|
use App\Services\SimpleLrcReader;
|
2024-01-04 21:51:32 +00:00
|
|
|
use Illuminate\Support\Facades\File;
|
2022-09-14 12:12:06 +00:00
|
|
|
use Illuminate\Support\Str;
|
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
class SimpleLrcReaderTest extends TestCase
|
|
|
|
{
|
|
|
|
private SimpleLrcReader $reader;
|
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
$this->reader = new SimpleLrcReader();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testTryReadForMediaFile(): void
|
|
|
|
{
|
|
|
|
$base = sys_get_temp_dir() . '/' . Str::uuid();
|
|
|
|
$lrcFile = $base . '.lrc';
|
|
|
|
|
2024-01-06 11:31:50 +00:00
|
|
|
File::copy(test_path('blobs/simple.lrc'), $lrcFile);
|
2022-09-14 12:12:06 +00:00
|
|
|
|
|
|
|
self::assertSame("Line 1\nLine 2\nLine 3", $this->reader->tryReadForMediaFile($base . '.mp3'));
|
2024-01-04 21:51:32 +00:00
|
|
|
File::delete($lrcFile);
|
2022-09-14 12:12:06 +00:00
|
|
|
}
|
|
|
|
}
|