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

initializeArgumentsAndRender() public method

Initialize the arguments of the ViewHelper, and call the render() method of the ViewHelper.
public initializeArgumentsAndRender ( ) : string
return string the rendered ViewHelper.
    public function initializeArgumentsAndRender()
    {
        $this->validateArguments();
        $this->initialize();
        $this->initializeWidgetContext();
        return $this->callRenderMethod();
    }

Usage Example

 /**
  * Calls the ViewHelper, and emulates a rendering.
  *
  * @return void
  */
 public function callViewHelper()
 {
     $this->viewHelper->expects($this->any())->method('getWidgetConfiguration')->will($this->returnValue(array('Some Widget Configuration')));
     $this->widgetContext->expects($this->once())->method('setNonAjaxWidgetConfiguration')->with(array('Some Widget Configuration'));
     $this->widgetContext->expects($this->once())->method('setWidgetIdentifier')->with(strtolower(str_replace('\\', '-', get_class($this->viewHelper))));
     $this->viewHelper->_set('controller', new \stdClass());
     $this->widgetContext->expects($this->once())->method('setControllerObjectName')->with('stdClass');
     $this->viewHelper->expects($this->once())->method('validateArguments');
     $this->viewHelper->expects($this->once())->method('initialize');
     $this->viewHelper->expects($this->once())->method('callRenderMethod')->will($this->returnValue('renderedResult'));
     $output = $this->viewHelper->initializeArgumentsAndRender(array('arg1' => 'val1'));
     $this->assertEquals('renderedResult', $output);
 }