public function testConstructor() { $loader =
new ProjectTemplateChainLoader([$this->loader1,
$this->loader2
]);
$this->
assertEquals([$this->loader1,
$this->loader2
],
$loader->
getLoaders(), '__construct() takes an array of template loaders as its second argument'
);
} public function testAddLoader() { $loader =
new ProjectTemplateChainLoader([$this->loader1
]);
$loader->
addLoader($this->loader2
);
$this->
assertEquals([$this->loader1,
$this->loader2
],
$loader->
getLoaders(), '->addLoader() adds a template loader at the end of the loaders'
);
} public function testLoad() { $loader =
new ProjectTemplateChainLoader([$this->loader1,
$this->loader2
]);
$this->
assertFalse($loader->
load(new TemplateReference('bar', 'php'
)), '->load() returns false if the template is not found'
);
$this->
assertFalse($loader->
load(new TemplateReference('foo', 'php'
)), '->load() returns false if the template does not exist for the given renderer'
);
$this->
assertInstanceOf( 'Symfony\Component\Templating\Storage\FileStorage',
$loader->
load(new TemplateReference('foo.php', 'php'
)),