示例#1
0
 /**
  * @param TwigConfig $config
  *
  * @return Twig_Loader_Filesystem
  * @throws Twig_Error_Loader
  */
 public function createTwigLoaderFilesystem(TwigConfig $config)
 {
     $loader = new TwigLoader();
     foreach ($config->getPaths() as $path) {
         $loader->addPath($path);
     }
     foreach ($config->getNamespaces() as $namespace => $path) {
         $loader->addPath($path, $namespace);
     }
     return $loader;
 }
示例#2
0
 function let(TwigConfig $config)
 {
     $config->getPaths()->willReturn([__DIR__ . '/path1', __DIR__ . '/path2']);
     $config->getNamespaces()->willReturn(['namespace1' => __DIR__ . '/path1', 'namespace2' => __DIR__ . '/path2']);
     $config->getDebug()->willReturn(true);
     $config->getCharset()->willReturn('utf-8');
     $config->getCache()->willReturn(false);
     $config->getBaseTemplateClass()->willReturn('class');
     $config->getAutoReload()->willReturn(true);
     $config->getAutoEscape()->willReturn(true);
     $config->getOptimizations()->willReturn(-1);
     $config->getStrictVariables()->willReturn(true);
     directory_create(__DIR__ . '/path1');
     directory_create(__DIR__ . '/path2');
 }