/** * Prepare classes for FE-rendering if it is needed in TYPO3 backend. * * @return \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController or tslib_fe */ public static function prepareTSFE($options = array()) { $pid = array_key_exists('pid', $options) ? $options['pid'] : 1; $type = array_key_exists('type', $options) ? $options['type'] : 99; $force = array_key_exists('force', $options) ? TRUE : FALSE; if (!is_object($GLOBALS['TT'])) { $className = tx_rnbase_util_Typo3Classes::getTimeTrackClass(); $GLOBALS['TT'] = new $className(); $GLOBALS['TT']->start(); } $typoScriptFrontendControllerClass = tx_rnbase_util_Typo3Classes::getTypoScriptFrontendControllerClass(); if (!is_object($GLOBALS['TSFE']) || !$GLOBALS['TSFE'] instanceof $typoScriptFrontendControllerClass || $force) { if (!defined('PATH_tslib')) { // PATH_tslib setzen if (@is_dir(PATH_site . 'typo3/sysext/cms/tslib/')) { define('PATH_tslib', PATH_site . 'typo3/sysext/cms/tslib/'); } elseif (@is_dir(PATH_site . 'tslib/')) { define('PATH_tslib', PATH_site . 'tslib/'); } else { define('PATH_tslib', ''); } } $GLOBALS['TSFE'] = tx_rnbase::makeInstance($typoScriptFrontendControllerClass, $GLOBALS['TYPO3_CONF_VARS'], $pid, $type); } // base user groups if (empty($GLOBALS['TSFE']->gr_list) || $force) { $GLOBALS['TSFE']->gr_list = '0,-1'; } // init the syspage for pageSelect if (!is_object($GLOBALS['TSFE']->sys_page) || $force) { $temp_sys_page = tx_rnbase_util_TYPO3::getSysPage(); $temp_sys_page->init(0); $GLOBALS['TSFE']->sys_page = $temp_sys_page; } // init the template if (!is_object($GLOBALS['TSFE']->tmpl) || $force) { $GLOBALS['TSFE']->initTemplate(); if (empty($GLOBALS['TSFE']->tmpl->getFileName_backPath)) { $GLOBALS['TSFE']->tmpl->getFileName_backPath = PATH_site; } } // initial empty config if (!is_array($GLOBALS['TSFE']->config)) { $GLOBALS['TSFE']->config = array(); } if (!is_array($GLOBALS['TSFE']->config['config'])) { $GLOBALS['TSFE']->config['config'] = array(); } // init the language if (empty($GLOBALS['TSFE']->lang) || $force) { $GLOBALS['TSFE']->initLLvars(); } return $GLOBALS['TSFE']; }
/** * @group unit */ public function testDoActionCallsPageNotFoundHandlingIfPageNotFoundException() { if (!tx_rnbase_util_TYPO3::isTYPO62OrHigher()) { self::markTestSkipped('Dieses Feature wird erst ab TYPO3 6.2 unterstützt'); } $controller = $this->getMock('tx_rnbase_controller', array('getTsfe')); $tsfe = $this->getMock(tx_rnbase_util_Typo3Classes::getTypoScriptFrontendControllerClass(), array('pageNotFoundAndExit'), array(), '', FALSE); $tsfe->expects(self::once())->method('pageNotFoundAndExit')->with('TYPO3\\CMS\\Core\\Error\\Http\\PageNotFoundException was thrown'); $controller->expects(self::once())->method('getTsfe')->will(self::returnValue($tsfe)); $parameters = $configurations = NULL; $controller->doAction('tx_rnbase_tests_action_throwPageNotFoundException', $parameters, $configurations); }