private function buildTwig(TwigFactory $twigFactory, array $layouts) { $templates = $this->processLayouts($layouts); $includesDir = $this->contentLocator->getIncludesDir(); $extraDirs = []; if ($includesDir) { $extraDirs[] = $includesDir; } $this->twig = $twigFactory->withAutoescape(false)->withCache(false)->addLoaderFilesystem($extraDirs)->addLoaderArray($templates)->addLoaderString()->create(); }
public function testCreateLoaderFilesystemNamespace() { $factory = new TwigFactory(); $twig = $factory->withAutoescape(false)->withCache(false)->withDebug(false)->addLoaderString()->addLoaderFilesystem(array('myNamespace' => __DIR__))->create(); $this->assertInstanceOf('Twig_Environment', $twig); }