2 namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Widget;
38 public function canHandleWidgetRequest()
41 $request = $this->getMock(\TYPO3\CMS\
Fluid\Core\Widget\WidgetRequest::class, array(
'dummy'), array(),
'',
false);
43 $abstractWidgetController = $this->getMock(\TYPO3\CMS\
Fluid\Core\Widget\AbstractWidgetController::class, array(
'dummy'), array(),
'',
false);
44 $this->assertTrue($abstractWidgetController->canProcessRequest($request));
50 public function processRequestSetsWidgetConfiguration()
52 $widgetContext = $this->getMock(\TYPO3\CMS\
Fluid\Core\Widget\WidgetContext::class);
53 $widgetContext->expects($this->once())->method(
'getWidgetConfiguration')->will($this->returnValue(
'myConfiguration'));
55 $request = $this->getMock(\TYPO3\CMS\
Fluid\Core\Widget\WidgetRequest::class, array(), array(),
'',
false);
56 $request->expects($this->once())->method(
'getWidgetContext')->will($this->returnValue($widgetContext));
58 $response = $this->getMock(\TYPO3\CMS\Extbase\Mvc\ResponseInterface::class);
60 $abstractWidgetController = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Widget\AbstractWidgetController::class, array(
'resolveActionMethodName',
'initializeActionMethodArguments',
'initializeActionMethodValidators',
'initializeAction',
'checkRequestHash',
'mapRequestArgumentsToControllerArguments',
'buildControllerContext',
'resolveView',
'callActionMethod'), array(),
'',
false);
61 $mockUriBuilder = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder::class);
62 $objectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
63 $objectManager->expects($this->any())->method(
'get')->with(\TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder::class)->will($this->returnValue($mockUriBuilder));
65 $configurationService = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Controller\MvcPropertyMappingConfigurationService::class);
66 $abstractWidgetController->_set(
'mvcPropertyMappingConfigurationService', $configurationService);
67 $abstractWidgetController->_set(
'arguments',
new Arguments());
69 $abstractWidgetController->_set(
'objectManager', $objectManager);
70 $abstractWidgetController->processRequest($request,
$response);
71 $widgetConfiguration = $abstractWidgetController->_get(
'widgetConfiguration');
72 $this->assertEquals(
'myConfiguration', $widgetConfiguration);
80 $frameworkConfiguration = array(
83 \TYPO3\CMS\
Fluid\ViewHelpers\Widget\PaginateViewHelper::class => array(
84 'templateRootPath' =>
'EXT:fluid/Resources/Private/DummyTestTemplates'
89 $widgetContext = $this->getMock(\TYPO3\CMS\
Fluid\Core\Widget\WidgetContext::class);
90 $widgetContext->expects($this->any())->method(
'getWidgetViewHelperClassName')->will($this->returnValue(\TYPO3\CMS\
Fluid\ViewHelpers\Widget\PaginateViewHelper::class));
91 $request = $this->getMock(\TYPO3\CMS\
Fluid\Core\Widget\WidgetRequest::class, array(), array(),
'',
false);
92 $request->expects($this->any())->method(
'getWidgetContext')->will($this->returnValue($widgetContext));
93 $configurationManager = $this->getMock(\TYPO3\CMS\Extbase\Configuration\ConfigurationManager::class);
94 $configurationManager->expects($this->any())->method(
'getConfiguration')->will($this->returnValue($frameworkConfiguration));
95 $view = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\View\TemplateView::class, array(
'dummy'), array(),
'',
false);
96 $abstractWidgetController = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Widget\AbstractWidgetController::class, array(
'dummy'));
97 $abstractWidgetController->_set(
'configurationManager', $configurationManager);
98 $abstractWidgetController->_set(
'request', $request);
99 $abstractWidgetController->_call(
'setViewConfiguration', $view);