$this->
assertTrue(ProjectTemplateFilesystemLoader::
isAbsolutePath('c:/foo.xml'
), '->isAbsolutePath() returns true if the path is an absolute path'
);
$this->
assertTrue(ProjectTemplateFilesystemLoader::
isAbsolutePath('\\server\\foo.xml'
), '->isAbsolutePath() returns true if the path is an absolute path'
);
$this->
assertTrue(ProjectTemplateFilesystemLoader::
isAbsolutePath('https://server/foo.xml'
), '->isAbsolutePath() returns true if the path is an absolute path'
);
$this->
assertTrue(ProjectTemplateFilesystemLoader::
isAbsolutePath('phar://server/foo.xml'
), '->isAbsolutePath() returns true if the path is an absolute path'
);
} public function testLoad() { $pathPattern = self::
$fixturesPath.'/templates/%name%';
$path = self::
$fixturesPath.'/templates';
$loader =
new ProjectTemplateFilesystemLoader($pathPattern);
$storage =
$loader->
load(new TemplateReference($path.'/foo.php', 'php'
));
$this->
assertInstanceOf(FileStorage::
class,
$storage, '->load() returns a FileStorage if you pass an absolute path'
);
$this->
assertEquals($path.'/foo.php',
(string) $storage, '->load() returns a FileStorage pointing to the passed absolute path'
);
$this->
assertFalse($loader->
load(new TemplateReference('bar', 'php'
)), '->load() returns false if the template is not found'
);
$storage =
$loader->
load(new TemplateReference('foo.php', 'php'
));
$this->
assertInstanceOf(FileStorage::
class,
$storage, '->load() returns a FileStorage if you pass a relative template that exists'
);
$this->
assertEquals($path.'/foo.php',
(string) $storage, '->load() returns a FileStorage pointing to the absolute path of the template'
);
$logger =
$this->
createMock(LoggerInterface::
class);
$logger->
expects($this->
exactly(2
))->
method('debug'
);