Fix path normalization problem

This commit is contained in:
Kijin Sung 2023-10-21 14:19:20 +09:00
parent 6085b82d19
commit fefd3dd895
8 changed files with 62 additions and 18 deletions

View file

@ -51,4 +51,17 @@ class TemplateTest extends \Codeception\Test\Unit
$target = '/rhymix/foo/bar.gif';
$this->assertEquals($target, $tmpl->convertPath($source));
}
public function testNormalizePath()
{
$tmpl = new \Rhymix\Framework\Template('./tests/_data/template', 'empty.html');
$source = '/rhymix/foo/bar//../hello/world\\..';
$target = '/rhymix/foo/hello';
$this->assertEquals($target, $tmpl->normalizePath($source));
$source = '../foo\\bar/../baz/';
$target = '../foo/baz/';
$this->assertEquals($target, $tmpl->normalizePath($source));
}
}