示例#1
0
 /**
  * @test
  */
 public function pushAndGetFromStackWorks()
 {
     $rootNode = new \TYPO3\CMS\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.');
 }
示例#2
0
 /**
  * Handles a closing view helper tag
  *
  * @param \TYPO3\CMS\Fluid\Core\Parser\ParsingState $state The current parsing state
  * @param string $namespaceIdentifier Namespace identifier for the closing tag.
  * @param string $methodIdentifier Method identifier.
  * @return void
  * @throws \TYPO3\CMS\Fluid\Core\Parser\Exception
  */
 protected function closingViewHelperTagHandler(\TYPO3\CMS\Fluid\Core\Parser\ParsingState $state, $namespaceIdentifier, $methodIdentifier)
 {
     if (!array_key_exists($namespaceIdentifier, $this->namespaces)) {
         throw new \TYPO3\CMS\Fluid\Core\Parser\Exception('Namespace could not be resolved. This exception should never be thrown!', 1224256186);
     }
     $lastStackElement = $state->popNodeFromStack();
     if (!$lastStackElement instanceof \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ViewHelperNode) {
         throw new \TYPO3\CMS\Fluid\Core\Parser\Exception('You closed a templating tag which you never opened!', 1224485838);
     }
     if ($lastStackElement->getViewHelperClassName() != $this->resolveViewHelperName($namespaceIdentifier, $methodIdentifier)) {
         throw new \TYPO3\CMS\Fluid\Core\Parser\Exception('Templating tags not properly nested. Expected: ' . $lastStackElement->getViewHelperClassName() . '; Actual: ' . $this->resolveViewHelperName($namespaceIdentifier, $methodIdentifier), 1224485398);
     }
     $this->callInterceptor($lastStackElement, \TYPO3\CMS\Fluid\Core\Parser\InterceptorInterface::INTERCEPT_CLOSING_VIEWHELPER, $state);
 }