private function assertCompilerOutput($source, $expected)
 {
     $nodes = $this->parser->parse($source);
     $compiler = new SourceCompiler(new SimpleComponentCompiler(), $this->componentsProvider);
     $compiled = $compiler->compileTemplate($nodes);
     echo $compiled;
     $compiledNodes = $this->phpParser->parse($compiled);
     $expectedNodes = $this->phpParser->parse($expected);
     $this->assertEquals($this->serializer->serialize($expectedNodes), $this->serializer->serialize($compiledNodes));
 }
Exemplo n.º 2
0
 /**
  * Compile XComponents source into raw PHP
  *
  * @param string $source
  * @return string
  */
 public function compile($source)
 {
     $nodes = $this->parser->parse($source);
     return $this->sourceCompiler->compileTemplate($nodes);
 }