Пример #1
0
 /**
  * @test
  */
 public function testParseCallsPreProcessOnTemplateProcessors()
 {
     $templateParser = new TemplateParser();
     $processor1 = $this->getMockForAbstractClass(TemplateProcessorInterface::class, array(), '', FALSE, FALSE, TRUE, array('preProcessSource'));
     $processor2 = clone $processor1;
     $processor1->expects($this->once())->method('preProcessSource')->with('source1')->willReturn('source2');
     $processor2->expects($this->once())->method('preProcesssource')->with('source2')->willReturn('final');
     $context = new RenderingContextFixture();
     $context->setTemplateProcessors(array($processor1, $processor2));
     $context->setVariableProvider(new StandardVariableProvider());
     $templateParser->setRenderingContext($context);
     $result = $templateParser->parse('source1')->render($context);
     $this->assertEquals('final', $result);
 }
Пример #2
0
 /**
  * Inject the Template Parser
  *
  * @param TemplateParser $templateParser The template parser
  * @return void
  */
 public function setTemplateParser(TemplateParser $templateParser)
 {
     $this->templateParser = $templateParser;
     $this->templateParser->setRenderingContext($this);
 }