mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 10:11:38 +09:00
Add unit tests for path conversion utilities in Template class
This commit is contained in:
parent
325c2c2b13
commit
ca5c96d02a
2 changed files with 62 additions and 2 deletions
|
|
@ -450,11 +450,17 @@ class Template
|
|||
* Convert a relative path using the given basepath.
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $basepath
|
||||
* @param ?string $basepath
|
||||
* @return string
|
||||
*/
|
||||
public function convertPath(string $path, string $basepath): string
|
||||
public function convertPath(string $path, ?string $basepath = null): string
|
||||
{
|
||||
// If basepath is not provided, use the relative dir of the current instance.
|
||||
if ($basepath === null)
|
||||
{
|
||||
$basepath = $this->relative_dirname;
|
||||
}
|
||||
|
||||
// Path relative to the Rhymix installation directory?
|
||||
if (preg_match('#^\^/?(\w.+)$#s', $path, $match))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue