[Templating] fixed 'scheme://' not detected as absolute path

This commit is contained in:
Oscar Cubo Medina 2011-12-08 13:39:00 +01:00
parent e6f2687107
commit 600066eda4
2 changed files with 3 additions and 0 deletions

View File

@ -115,6 +115,7 @@ class FilesystemLoader extends Loader
&& $file[1] == ':'
&& ($file[2] == '\\' || $file[2] == '/')
)
|| null !== parse_url($file, PHP_URL_SCHEME)
) {
return true;
}

View File

@ -42,6 +42,8 @@ class FilesystemLoaderTest extends \PHPUnit_Framework_TestCase
$this->assertTrue(ProjectTemplateLoader2::isAbsolutePath('c:\\\\foo.xml'), '->isAbsolutePath() returns true if the path is an absolute path');
$this->assertTrue(ProjectTemplateLoader2::isAbsolutePath('c:/foo.xml'), '->isAbsolutePath() returns true if the path is an absolute path');
$this->assertTrue(ProjectTemplateLoader2::isAbsolutePath('\\server\\foo.xml'), '->isAbsolutePath() returns true if the path is an absolute path');
$this->assertTrue(ProjectTemplateLoader2::isAbsolutePath('https://server/foo.xml'), '->isAbsolutePath() returns true if the path is an absolute path');
$this->assertTrue(ProjectTemplateLoader2::isAbsolutePath('phar://server/foo.xml'), '->isAbsolutePath() returns true if the path is an absolute path');
}
public function testLoad()