Exemple #1
0
 /**
  * Executes this finisher
  * @see AbstractFinisher::execute()
  *
  * @return void
  */
 protected function executeInternal()
 {
     $formRuntime = $this->finisherContext->getFormRuntime();
     $this->request = $formRuntime->getRequest();
     $this->response = $formRuntime->getResponse();
     $this->uriBuilder = $this->objectManager->get(UriBuilder::class);
     $this->uriBuilder->setRequest($this->request);
     $pageUid = (int) str_replace('pages_', '', $this->parseOption('pageUid'));
     $additionalParameters = $this->parseOption('additionalParameters');
     $additionalParameters = '&' . ltrim($additionalParameters, '&');
     $delay = (int) $this->parseOption('delay');
     $statusCode = (int) $this->parseOption('statusCode');
     $this->finisherContext->cancel();
     $this->redirect($pageUid, $additionalParameters, $delay, $statusCode);
 }
 /**
  * @throws \InvalidArgumentException
  * @throws \PHPUnit_Framework_Exception
  */
 protected function setUp()
 {
     $GLOBALS['TSFE'] = $this->getMock(TypoScriptFrontendController::class, array(), array(), '', false);
     $this->mockContentObject = $this->getMock(ContentObjectRenderer::class);
     $this->mockRequest = $this->getMock(Request::class);
     $this->mockExtensionService = $this->getMock(ExtensionService::class);
     $this->mockConfigurationManager = $this->getMock(ConfigurationManagerInterface::class);
     $this->uriBuilder = $this->getAccessibleMock(UriBuilder::class, array('build'));
     $this->uriBuilder->setRequest($this->mockRequest);
     $this->uriBuilder->_set('contentObject', $this->mockContentObject);
     $this->uriBuilder->_set('configurationManager', $this->mockConfigurationManager);
     $this->uriBuilder->_set('extensionService', $this->mockExtensionService);
     $this->uriBuilder->_set('environmentService', $this->getMock(EnvironmentService::class));
     // Mocking backend user is required for backend URI generation as BackendUtility::getModuleUrl() is called
     $backendUserMock = $this->getMock(BackendUserAuthentication::class);
     $backendUserMock->expects($this->any())->method('check')->will($this->returnValue(true));
     $GLOBALS['BE_USER'] = $backendUserMock;
 }
 public function setUp()
 {
     $GLOBALS['TSFE'] = $this->getMock('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', array(), array(), '', FALSE);
     $this->mockContentObject = $this->getMock('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
     $this->mockRequest = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request');
     $this->mockExtensionService = $this->getMock('TYPO3\\CMS\\Extbase\\Service\\ExtensionService');
     $this->mockConfigurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface');
     $this->uriBuilder = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder', array('build'));
     $this->uriBuilder->setRequest($this->mockRequest);
     $this->uriBuilder->_set('contentObject', $this->mockContentObject);
     $this->uriBuilder->_set('configurationManager', $this->mockConfigurationManager);
     $this->uriBuilder->_set('extensionService', $this->mockExtensionService);
     $this->uriBuilder->_set('environmentService', $this->getMock('TYPO3\\CMS\\Extbase\\Service\\EnvironmentService'));
     // Mocking backend user is required for backend URI generation as BackendUtility::getModuleUrl() is called
     $backendUserMock = $this->getMock('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication');
     $backendUserMock->expects($this->any())->method('check')->will($this->returnValue(TRUE));
     $GLOBALS['BE_USER'] = $backendUserMock;
 }
 /**
  * Create doc header drop down
  *
  * @return void
  */
 protected function createMenu()
 {
     $this->uriBuilder->setRequest($this->request);
     $menu = $this->view->getModuleTemplate()->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
     $menu->setIdentifier('cadabra');
     $actions = [['action' => 'index', 'label' => 'listProducts'], ['action' => 'listArticles', 'label' => 'listArticles']];
     foreach ($actions as $action) {
         $item = $menu->makeMenuItem()->setTitle($this->getLanguageService()->sL($this->settings['LLL']['productadministration'] . ':module.' . $action['label']))->setHref($this->uriBuilder->reset()->uriFor($action['action'], [], 'Backend\\Product'))->setActive($this->request->getControllerActionName() === $action['action']);
         $menu->addMenuItem($item);
     }
     $this->view->getModuleTemplate()->getDocHeaderComponent()->getMenuRegistry()->addMenu($menu);
     $pageInfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->pageUid, '');
     $this->view->getModuleTemplate()->getDocHeaderComponent()->setMetaInformation($pageInfo);
 }
 /**
  * Processes a general request. The result can be returned by altering the given response.
  *
  * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface $request The request object
  * @param \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response The response, modified by this handler
  * @return void
  * @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException if the controller doesn't support the current request type
  * @api
  */
 public function processRequest(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response)
 {
     if (!$this->canProcessRequest($request)) {
         throw new \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException(get_class($this) . ' does not support requests of type "' . get_class($request) . '". Supported types are: ' . implode(' ', $this->supportedRequestTypes), 1187701132);
     }
     $response->setRequest($request);
     $this->request = $request;
     $this->request->setDispatched(TRUE);
     $this->response = $response;
     $this->uriBuilder = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder');
     $this->uriBuilder->setRequest($request);
     $this->initializeControllerArgumentsBaseValidators();
     $this->mapRequestArgumentsToControllerArguments();
     $this->controllerContext = $this->buildControllerContext();
 }