/**
  * @test
  * @author Sebastian Kurfürst <*****@*****.**>
  */
 public function pushAndGetFromStackWorks()
 {
     $rootNode = new \F3\Fluid\Core\Parser\SyntaxTree\RootNode();
     $this->parsingState->pushNodeToStack($rootNode);
     $this->assertSame($rootNode, $this->parsingState->getNodeFromStack($rootNode), 'Node returned from stack was not the right one.');
     $this->assertSame($rootNode, $this->parsingState->popNodeFromStack($rootNode), 'Node popped from stack was not the right one.');
 }
 /**
  * Initialize the given ViewHelper and adds it to the current node and to
  * the stack.
  *
  * @param \F3\Fluid\Core\Parser\ParsingState $state Current parsing state
  * @param string $namespaceIdentifier Namespace identifier - being looked up in $this->namespaces
  * @param string $methodIdentifier Method identifier
  * @param array $argumentsObjectTree Arguments object tree
  * @return void
  * @author Sebastian Kurfürst <*****@*****.**>
  * @author Karsten Dambekalns <*****@*****.**>
  */
 protected function initializeViewHelperAndAddItToStack(\F3\Fluid\Core\Parser\ParsingState $state, $namespaceIdentifier, $methodIdentifier, $argumentsObjectTree)
 {
     if (!array_key_exists($namespaceIdentifier, $this->namespaces)) {
         throw new \F3\Fluid\Core\Parser\Exception('Namespace could not be resolved. This exception should never be thrown!', 1224254792);
     }
     $viewHelper = $this->objectFactory->create($this->resolveViewHelperName($namespaceIdentifier, $methodIdentifier));
     $expectedViewHelperArguments = $viewHelper->prepareArguments();
     $this->abortIfUnregisteredArgumentsExist($expectedViewHelperArguments, $argumentsObjectTree);
     $this->abortIfRequiredArgumentsAreMissing($expectedViewHelperArguments, $argumentsObjectTree);
     $currentDynamicNode = $this->objectFactory->create('F3\\Fluid\\Core\\Parser\\SyntaxTree\\ViewHelperNode', $viewHelper, $argumentsObjectTree);
     $state->getNodeFromStack()->addChildNode($currentDynamicNode);
     // PostParse Facet
     if ($viewHelper instanceof \F3\Fluid\Core\ViewHelper\Facets\PostParseInterface) {
         $viewHelper::postParseEvent($currentDynamicNode, $argumentsObjectTree, $state->getVariableContainer());
     }
     $state->pushNodeToStack($currentDynamicNode);
 }