/** * @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(\Neos\FluidAdaptor\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(\Neos\Flow\Mvc\ActionRequest::class)->disableOriginalConstructor()->getMock(); $this->mockObjectManager->expects($this->atLeastOnce())->method('get')->with(\Neos\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(); }