Sets the Compiler instance.
public setCompiler ( Twig_CompilerInterface $compiler ) | ||
$compiler | Twig_CompilerInterface | A Twig_CompilerInterface instance |
/** * @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)); }
protected function setUp() { $this->env = $env = new \Twig_Environment(); $env->addExtension(new \Twig_Extension_Core()); $env->setCompiler($this->compiler = new JsCompiler($env)); }