/**
  * @test
  */
 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();
 }
 /**
  * @test
  */
 public function handleInjectsActionRequestToSecurityContext()
 {
     $mockWidgetId = 'SomeWidgetId';
     $mockControllerObjectName = 'SomeControllerObjectName';
     $this->mockHttpRequest->expects($this->at(0))->method('hasArgument')->with('__widgetId')->will($this->returnValue(true));
     $this->mockHttpRequest->expects($this->atLeastOnce())->method('getArgument')->with('__widgetId')->will($this->returnValue($mockWidgetId));
     $mockWidgetContext = $this->getMockBuilder(\TYPO3\Fluid\Core\Widget\WidgetContext::class)->getMock();
     $mockWidgetContext->expects($this->atLeastOnce())->method('getControllerObjectName')->will($this->returnValue($mockControllerObjectName));
     $this->mockAjaxWidgetContextHolder->expects($this->atLeastOnce())->method('get')->with($mockWidgetId)->will($this->returnValue($mockWidgetContext));
     $mockActionRequest = $this->getMockBuilder(\TYPO3\Flow\Mvc\ActionRequest::class)->disableOriginalConstructor()->getMock();
     $this->mockObjectManager->expects($this->atLeastOnce())->method('get')->with(\TYPO3\Flow\Mvc\ActionRequest::class)->will($this->returnValue($mockActionRequest));
     $this->mockSecurityContext->expects($this->once())->method('setRequest')->with($mockActionRequest);
     $this->ajaxWidgetComponent->handle($this->mockComponentContext);
 }
 /**
  * @test
  */
 public function initializeArgumentsAndRenderStoresTheWidgetContextIfInAjaxMode()
 {
     $this->viewHelper->_set('ajaxWidget', TRUE);
     $this->ajaxWidgetContextHolder->expects($this->once())->method('store')->with($this->widgetContext);
     $this->callViewHelper();
 }