Skip to content

A self-hosted media server and file management system

724 B
Raw Blame
<?php

namespace Tests\Unit\Services\Subtitles;

use App\Services\Subtitles\SubtitlePath;
use Illuminate\Support\Str;
use Tests\TestCase;

class SubtitlePathTest extends TestCase {
    public function test_get_file_path_returns_correct_path() {
        $uuid = Str::uuid()->toString();
        $path = SubtitlePath::buildFilePath($uuid, 2, 'vtt');

        $this->assertEquals('metadata/media/' . substr($uuid, 0, 2) . "/{$uuid}/subtitles/2.vtt", $path);
    }

    public function test_get_directory_path() {
        $uuid = Str::uuid()->toString();

        $this->assertEquals(
            'metadata/media/' . substr($uuid, 0, 2) . "/{$uuid}/subtitles",
            SubtitlePath::buildDirectory($uuid)
        );
    }
}