ProjectTemplateChainLoader example

protected FilesystemLoader $loader2;

    protected function setUp(): void
    {
        $fixturesPath = realpath(__DIR__.'/../Fixtures/');
        $this->loader1 = new FilesystemLoader($fixturesPath.'/null/%name%');
        $this->loader2 = new FilesystemLoader($fixturesPath.'/templates/%name%');
    }

    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()
    {
Home | Imprint | This part of the site doesn't use cookies.