/** * @test */ public function setChildNodesAddsChildNodesToWidgetContext() { $node1 = $this->getMock('TYPO3\\Fluid\\Core\\Parser\\SyntaxTree\\AbstractNode'); $node2 = $this->getMock('TYPO3\\Fluid\\Core\\Parser\\SyntaxTree\\TextNode', array(), array(), '', FALSE); $node3 = $this->getMock('TYPO3\\Fluid\\Core\\Parser\\SyntaxTree\\AbstractNode'); $rootNode = $this->getMock('TYPO3\\Fluid\\Core\\Parser\\SyntaxTree\\RootNode'); $rootNode->expects($this->at(0))->method('addChildNode')->with($node1); $rootNode->expects($this->at(1))->method('addChildNode')->with($node2); $rootNode->expects($this->at(2))->method('addChildNode')->with($node3); $this->objectManager->expects($this->once())->method('create')->with('TYPO3\\Fluid\\Core\\Parser\\SyntaxTree\\RootNode')->will($this->returnValue($rootNode)); $renderingContext = $this->getMock('TYPO3\\Fluid\\Core\\Rendering\\RenderingContextInterface'); $this->viewHelper->_set('renderingContext', $renderingContext); $this->widgetContext->expects($this->once())->method('setViewHelperChildNodes')->with($rootNode, $renderingContext); $this->viewHelper->setChildNodes(array($node1, $node2, $node3)); }
/** * @test */ public function setChildNodesAddsChildNodesToWidgetContext() { $this->widgetContext = new \TYPO3\Fluid\Core\Widget\WidgetContext(); $this->viewHelper->injectWidgetContext($this->widgetContext); $node1 = $this->getMock(\TYPO3\Fluid\Core\Parser\SyntaxTree\AbstractNode::class); $node2 = $this->getMock(\TYPO3\Fluid\Core\Parser\SyntaxTree\TextNode::class, array(), array(), '', FALSE); $node3 = $this->getMock(\TYPO3\Fluid\Core\Parser\SyntaxTree\AbstractNode::class); $rootNode = new \TYPO3\Fluid\Core\Parser\SyntaxTree\RootNode(); $rootNode->addChildNode($node1); $rootNode->addChildNode($node2); $rootNode->addChildNode($node3); $this->objectManager->expects($this->once())->method('get')->with(\TYPO3\Fluid\Core\Parser\SyntaxTree\RootNode::class)->will($this->returnValue($rootNode)); $renderingContext = $this->getMock(\TYPO3\Fluid\Core\Rendering\RenderingContextInterface::class); $this->viewHelper->_set('renderingContext', $renderingContext); $this->viewHelper->setChildNodes(array($node1, $node2, $node3)); $this->assertEquals($rootNode, $this->widgetContext->getViewHelperChildNodes()); }