示例#1
0
 /**
  * @test
  */
 public function buildTypolinkConfigurationConvertsDomainObjects()
 {
     $mockDomainObject1 = $this->getAccessibleMock(AbstractEntity::class, array('dummy'));
     $mockDomainObject1->_set('uid', '123');
     $mockDomainObject2 = $this->getAccessibleMock(AbstractEntity::class, array('dummy'));
     $mockDomainObject2->_set('uid', '321');
     $this->uriBuilder->setTargetPageUid(123);
     $this->uriBuilder->setArguments(array('someDomainObject' => $mockDomainObject1, 'baz' => array('someOtherDomainObject' => $mockDomainObject2)));
     $expectedConfiguration = array('parameter' => 123, 'useCacheHash' => 1, 'additionalParams' => '&someDomainObject=123&baz[someOtherDomainObject]=321');
     $actualConfiguration = $this->uriBuilder->_call('buildTypolinkConfiguration');
     $this->assertEquals($expectedConfiguration, $actualConfiguration);
 }
 /**
  * Page not found handling
  *
  * @param array $params
  * @param TypoScriptFrontendController $ref
  * @throws PageNotFoundException
  * @return void
  */
 public function pageNotFound(array $params, TypoScriptFrontendController $ref = NULL)
 {
     $domain = GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
     $domainInformation = parse_url($domain);
     $errorPageUid = (int) $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['theme']['errorPages']['_DEFAULT'];
     if (!empty($domainInformation['host'])) {
         $tmpErrorPageUid = (int) $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['theme']['errorPages'][$domainInformation['host']];
         if ($tmpErrorPageUid > 0) {
             $errorPageUid = $tmpErrorPageUid;
         }
     }
     if ($errorPageUid > 0) {
         $sysLanguageUid = $this->getSysLanguage($ref);
         $this->uriBuilder->reset()->setTargetPageUid($errorPageUid)->setCreateAbsoluteUri(TRUE);
         if ($sysLanguageUid > 0) {
             $this->uriBuilder->setArguments(array('L' => $sysLanguageUid));
         }
         HttpUtility::redirect($this->uriBuilder->buildFrontendUri(), HttpUtility::HTTP_STATUS_404);
     }
     $message = 'The page not found handling could not handle the request. The original message was: "' . $params['reasonText'] . '" with URL "' . $params['currentUrl'] . '"';
     throw new PageNotFoundException($message, 1301648780);
 }