setCompiler() публичный Метод

Sets the Compiler instance.
public setCompiler ( Twig_CompilerInterface $compiler )
$compiler Twig_CompilerInterface A Twig_CompilerInterface instance
Пример #1
0
 /**
  * @dataProvider getGenerationTests
  */
 public function testGenerate($inputFile, $outputFile)
 {
     $env = new \Twig_Environment();
     $env->addExtension(new \Twig_Extension_Core());
     $env->addExtension(new TwigJsExtension());
     $env->setLoader(new \Twig_Loader_Filesystem(__DIR__ . '/Fixture/templates'));
     $env->setCompiler(new JsCompiler($env));
     $source = file_get_contents($inputFile);
     $this->assertEquals(file_get_contents($outputFile), $env->compileSource($source, $inputFile));
 }
Пример #2
0
 protected function setUp()
 {
     $this->env = $env = new \Twig_Environment();
     $env->addExtension(new \Twig_Extension_Core());
     $env->setCompiler($this->compiler = new JsCompiler($env));
 }