<?php

namespace App\Tests\Unit\Service\Utils;

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

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

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