<?php
namespace App\Tests\Unit\Service\Utils;

use App\Service\Utils\Path;
use PHPUnit\Framework\TestCase;

class PathTest extends TestCase
{
    /**
     * @see Path::getProjectDir()
     */
    public function testGetProjectDir():void
    {
        $this->assertFileExists(Path::getProjectDir() . '/phpunit.xml.dist');
    }

    /**
     * @see Path::join()
     */
    public function testJoin(): void {
        $this->assertEquals("", Path::join("", ""));
        $this->assertEquals("/", Path::join("", "/"));
        $this->assertEquals("/a", Path::join("/", "a"));
        $this->assertEquals("/a", Path::join("/", "/a"));
        $this->assertEquals("abc/def", Path::join("abc", "def"));
        $this->assertEquals("abc/def", Path::join("abc", "/def"));
        $this->assertEquals("/abc/def", Path::join("/abc", "def"));
        $this->assertEquals("foo.jpg", Path::join("", "foo.jpg"));
        $this->assertEquals("dir/0/a.jpg", Path::join("dir", "0", "a.jpg"));
    }
}
