/**
  * @return ParsingState
  */
 protected function getParsingState()
 {
     $rootNode = new RootNode();
     $state = new ParsingState();
     $state->setVariableProvider($this->variableProvider);
     $state->setViewHelperResolver($this->viewHelperResolver);
     $state->setRootNode($rootNode);
     $state->pushNodeToStack($rootNode);
     return $state;
 }
 /**
  * @test
  */
 public function testGenerateSectionCodeFromParsingState()
 {
     $foo = new TextNode('foo');
     $bar = new TextNode('bar');
     $parsingState = new ParsingState();
     $container = new StandardVariableProvider(array('sections' => array($foo, $bar)));
     $parsingState->setVariableProvider($container);
     $nodeConverter = $this->getMock('NamelessCoder\\Fluid\\Core\\Compiler\\NodeConverter', array('convertListOfSubNodes'), array(), '', FALSE);
     $nodeConverter->expects($this->at(0))->method('convertListOfSubNodes')->with($foo)->willReturn(array());
     $nodeConverter->expects($this->at(1))->method('convertListOfSubNodes')->with($bar)->willReturn(array());
     $instance = $this->getMock('NamelessCoder\\Fluid\\Core\\Compiler\\TemplateCompiler', array('generateCodeForSection'));
     $instance->expects($this->at(0))->method('generateCodeForSection')->with($this->anything())->willReturn('FOO');
     $instance->expects($this->at(1))->method('generateCodeForSection')->with($this->anything())->willReturn('BAR');
     $instance->setNodeConverter($nodeConverter);
     $method = new \ReflectionMethod($instance, 'generateSectionCodeFromParsingState');
     $method->setAccessible(TRUE);
     $result = $method->invokeArgs($instance, array($parsingState));
     $this->assertEquals('FOOBAR', $result);
 }