/** * @test * @author Sebastian Kurfürst <*****@*****.**> */ public function renderCallsTheRightMethodsOnTheRootNode() { $renderingContext = $this->getMock('Tx_Fluid_Core_Rendering_RenderingContextInterface'); $rootNode = $this->getMock('Tx_Fluid_Core_Parser_SyntaxTree_RootNode'); $rootNode->expects($this->once())->method('evaluate')->with($renderingContext)->will($this->returnValue('T3DD09 Rock!')); $this->parsingState->setRootNode($rootNode); $renderedValue = $this->parsingState->render($renderingContext); $this->assertEquals($renderedValue, 'T3DD09 Rock!', 'The rendered value of the Root Node is not returned by the ParsingState.'); }
/** * Text node handler * * @param Tx_Fluid_Core_Parser_ParsingState $state * @param string $text * @return void * @author Sebastian Kurfürst <*****@*****.**> * @author Karsten Dambekalns <*****@*****.**> */ protected function textHandler(Tx_Fluid_Core_Parser_ParsingState $state, $text) { $node = $this->objectManager->create('Tx_Fluid_Core_Parser_SyntaxTree_TextNode', $text); $this->callInterceptor($node, Tx_Fluid_Core_Parser_InterceptorInterface::INTERCEPT_TEXT); $state->getNodeFromStack()->addChildNode($node); }
/** * @test * @author Sebastian Kurfürst <*****@*****.**> */ public function viewIsPlacedInVariableContainer() { $this->markTestSkipped('view will be placed in ViewHelperContext soon'); $packageManager = t3lib_div::makeInstance('Tx_Fluid_Package_PackageManagerInterface'); $resourceManager = t3lib_div::makeInstance('Tx_Fluid_Resource_ResourceManager'); $syntaxTreeNode = new Tx_Fluid_View_Fixture_TransparentSyntaxTreeNode(); $parsingState = new Tx_Fluid_Core_Parser_ParsingState(); $parsingState->setRootNode($syntaxTreeNode); $templateParserMock = $this->getMock('Tx_Fluid_Core_Parser_TemplateParser', array('parse')); $templateParserMock->expects($this->any())->method('parse')->will($this->returnValue($parsingState)); $mockRequest = $this->getMock('Tx_Extbase_MVC_Request'); $mockRequest->expects($this->any())->method('getControllerActionName')->will($this->returnValue('index')); $mockRequest->expects($this->any())->method('getControllerObjectName')->will($this->returnValue('Tx_Fluid_Foo_Bar_Controller_BazController')); $mockRequest->expects($this->any())->method('getControllerPackageKey')->will($this->returnValue('Fluid')); $mockControllerContext = $this->getMock('Tx_Extbase_MVC_Controller_ControllerContext', array('getRequest'), array(), '', FALSE); $mockControllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($mockRequest)); $templateView = new Tx_Fluid_View_Fixture_TemplateViewFixture(new Tx_Fluid_Compatibility_ObjectManager(), $packageManager, $resourceManager, new Tx_Fluid_Compatibility_ObjectManager()); $templateView->injectTemplateParser($templateParserMock); $templateView->setTemplatePathAndFilename(dirname(__FILE__) . '/Fixtures/TemplateViewSectionFixture.html'); $templateView->setLayoutPathAndFilename(dirname(__FILE__) . '/Fixtures/LayoutFixture.html'); $templateView->setControllerContext($mockControllerContext); $templateView->initializeObject(); $templateView->addVariable('name', 'value'); $templateView->render(); $this->assertSame($templateView, $syntaxTreeNode->variableContainer->get('view'), 'The view has not been placed in the variable container.'); $this->assertEquals('value', $syntaxTreeNode->variableContainer->get('name'), 'Context variable has been set.'); }