/**
  * @test
  * @author Sebastian Kurfürst <*****@*****.**>
  * @author Bastian Waidelich <*****@*****.**>
  */
 public function buildSetsWidgetContext()
 {
     $_GET = array('fluid-widget-id' => '123');
     $this->mockAjaxWidgetContextHolder->expects($this->once())->method('get')->with('123')->will($this->returnValue($this->mockWidgetContext));
     $this->mockWidgetRequest->expects($this->once())->method('setWidgetContext')->with($this->mockWidgetContext);
     $this->widgetRequestBuilder->build();
 }
 /**
  * Builds a widget request object from the raw HTTP information
  *
  * @return Tx_Fluid_Core_Widget_WidgetRequest The widget request as an object
  * @author Sebastian Kurfürst <*****@*****.**>
  */
 public function build()
 {
     $request = $this->objectManager->create('Tx_Fluid_Core_Widget_WidgetRequest');
     $request->setRequestURI(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'));
     $request->setBaseURI(t3lib_div::getIndpEnv('TYPO3_SITE_URL'));
     $request->setMethod(isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : NULL);
     if (strtolower($_SERVER['REQUEST_METHOD']) === 'post') {
         $request->setArguments(t3lib_div::_POST());
     } else {
         $request->setArguments(t3lib_div::_GET());
     }
     $rawGetArguments = t3lib_div::_GET();
     // TODO: rename to @action, to be consistent with normal naming?
     if (isset($rawGetArguments['action'])) {
         $request->setControllerActionName($rawGetArguments['action']);
     }
     $widgetContext = $this->ajaxWidgetContextHolder->get($rawGetArguments['fluid-widget-id']);
     $request->setWidgetContext($widgetContext);
     return $request;
 }
 /**
  * Initialize the Widget Context, before the Render method is called.
  *
  * @return void
  * @author Sebastian Kurfürst <*****@*****.**>
  */
 private function initializeWidgetContext()
 {
     $this->widgetContext->setWidgetConfiguration($this->getWidgetConfiguration());
     $this->initializeWidgetIdentifier();
     $controllerObjectName = $this->controller instanceof Tx_Fluid_AOP_ProxyInterface ? $this->controller->FLOW3_AOP_Proxy_getProxyTargetClassName() : get_class($this->controller);
     $this->widgetContext->setControllerObjectName($controllerObjectName);
     $extensionName = $this->controllerContext->getRequest()->getControllerExtensionName();
     $pluginName = $this->controllerContext->getRequest()->getPluginName();
     $this->widgetContext->setParentExtensionName($extensionName);
     $this->widgetContext->setParentPluginName($pluginName);
     $pluginNamespace = Tx_Extbase_Utility_Extension::getPluginNamespace($extensionName, $pluginName);
     $this->widgetContext->setParentPluginNamespace($pluginNamespace);
     $this->widgetContext->setWidgetViewHelperClassName(get_class($this));
     if ($this->ajaxWidget === TRUE) {
         $this->ajaxWidgetContextHolder->store($this->widgetContext);
     }
 }
 /**
  * @test
  * @author Sebastian Kurfürst <*****@*****.**>
  */
 public function initializeArgumentsAndRenderStoresTheWidgetContextIfInAjaxMode()
 {
     $this->viewHelper->_set('ajaxWidget', TRUE);
     $this->ajaxWidgetContextHolder->expects($this->once())->method('store')->with($this->widgetContext);
     $this->callViewHelper();
 }