mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 09:41:40 +09:00
Improve relative path handling in Template v2 #2310
This commit is contained in:
parent
242d07ce30
commit
e57c6c5c25
2 changed files with 23 additions and 5 deletions
|
|
@ -58,11 +58,27 @@ class TemplateTest extends \Codeception\Test\Unit
|
|||
$tmpl = new \Rhymix\Framework\Template('./tests/_data/template', 'empty.html');
|
||||
|
||||
$source = '/rhymix/foo/bar//../hello/world\\..';
|
||||
$target = '/rhymix/foo/hello';
|
||||
$target = '/rhymix/foo/hello/';
|
||||
$this->assertEquals($target, $tmpl->normalizePath($source));
|
||||
|
||||
$source = '../foo\\bar/../baz/';
|
||||
$target = '../foo/baz/';
|
||||
$this->assertEquals($target, $tmpl->normalizePath($source));
|
||||
|
||||
$source = '/fo/ob/ar/../../baz/./buzz.txt';
|
||||
$target = '/fo/baz/buzz.txt';
|
||||
$this->assertEquals($target, $tmpl->normalizePath($source));
|
||||
|
||||
$source = 'foo/bar/../../baz/buzz.txt';
|
||||
$target = 'baz/buzz.txt';
|
||||
$this->assertEquals($target, $tmpl->normalizePath($source));
|
||||
|
||||
$source = 'tests/unit/foo/bar/../../../../../../buzz.txt';
|
||||
$target = '../../buzz.txt';
|
||||
$this->assertEquals($target, $tmpl->normalizePath($source));
|
||||
|
||||
$source = 'tests/unit/foo/bar/../../../../.././';
|
||||
$target = '../';
|
||||
$this->assertEquals($target, $tmpl->normalizePath($source));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue