$t = new LimeTest(5); class ProjectTemplateLoader extends ChainLoader { public function getLoaders() { return $this->loaders; } } $loader1 = new FilesystemLoader($fixturesPath.'/null/%name%'); $loader2 = new FilesystemLoader($fixturesPath.'/templates/%name%.%renderer%'); // __construct() $t->diag('__construct()'); $loader = new ProjectTemplateLoader(array($loader1, $loader2)); $t->is($loader->getLoaders(), array($loader1, $loader2), '__construct() takes an array of template loaders as its second argument'); // ->addLoader() $t->diag('->addLoader()'); $loader = new ProjectTemplateLoader(array($loader1)); $loader->addLoader($loader2); $t->is($loader->getLoaders(), array($loader1, $loader2), '->addLoader() adds a template loader at the end of the loaders'); // ->load() $t->diag('->load()'); $loader = new ProjectTemplateLoader(array($loader1, $loader2)); $t->ok($loader->load('bar') === false, '->load() returns false if the template is not found'); $t->ok($loader->load('foo', array('renderer' => 'xml')) === false, '->load() returns false if the template does not exists for the given renderer'); $t->ok($loader->load('foo') instanceof FileStorage, '->load() returns a FileStorage if the template exists');