Neos\FluidAdaptor\Core\Widget\AbstractWidgetViewHelper::injectWidgetContext PHP Method

injectWidgetContext() public method

public injectWidgetContext ( WidgetContext $widgetContext ) : void
$widgetContext WidgetContext
return void
    public function injectWidgetContext(WidgetContext $widgetContext)
    {
        $this->widgetContext = $widgetContext;
    }

Usage Example

 /**
  * @test
  */
 public function setChildNodesAddsChildNodesToWidgetContext()
 {
     $this->widgetContext = new \Neos\FluidAdaptor\Core\Widget\WidgetContext();
     $this->viewHelper->injectWidgetContext($this->widgetContext);
     $node1 = $this->createMock(AbstractNode::class);
     $node2 = $this->getMockBuilder(TextNode::class)->disableOriginalConstructor()->getMock();
     $node3 = $this->createMock(AbstractNode::class);
     $rootNode = new RootNode();
     $rootNode->addChildNode($node1);
     $rootNode->addChildNode($node2);
     $rootNode->addChildNode($node3);
     $renderingContext = $this->createMock(RenderingContextInterface::class);
     $this->viewHelper->_set('renderingContext', $renderingContext);
     $this->viewHelper->setChildNodes(array($node1, $node2, $node3));
     $this->assertEquals($rootNode, $this->widgetContext->getViewHelperChildNodes());
 }