22
33namespace In2code \Lux \Tests \Helper ;
44
5- use TYPO3 \CMS \Core \Configuration \ConfigurationManager ;
6- use TYPO3 \CMS \Core \TimeTracker \TimeTracker ;
7- use TYPO3 \CMS \Frontend \Controller \TypoScriptFrontendController ;
8-
9- /**
10- * Class TestingHelper
11- */
125class TestingHelper
136{
147 /**
158 * @return void
169 * @SuppressWarnings(PHPMD.Superglobals)
1710 */
18- public static function setDefaultConstants ()
11+ public static function setDefaultConstants (): void
1912 {
13+ $ GLOBALS ['TYPO3_CONF_VARS ' ]['EXTENSIONS ' ]['lux ' ]['testingContext ' ] = 1 ;
14+
2015 $ GLOBALS ['TYPO3_CONF_VARS ' ]['EXT ' ]['extConf ' ]['lux ' ] =
2116 'a:11:{s:13:"checkFunction";s:4:"User";s:18:"scoringCalculation";s:96:" ' .
2217 '(10 * numberOfSiteVisits) + (1 * numberOfPageVisits) + (20 * downloads) - (1 * lastVisitDaysAgo)"; ' .
@@ -33,7 +28,6 @@ public static function setDefaultConstants()
3328 $ GLOBALS ['TYPO3_CONF_VARS ' ]['BE ' ]['lockRootPath ' ] = '' ;
3429 $ GLOBALS ['TYPO3_CONF_VARS ' ]['BE ' ]['cookieName ' ] = '' ;
3530 $ GLOBALS ['TYPO3_CONF_VARS ' ]['BE ' ]['warning_email_addr ' ] = '' ;
36- $ GLOBALS ['TYPO3_CONF_VARS ' ]['BE ' ]['lockIP ' ] = '' ;
3731 $ GLOBALS ['TYPO3_CONF_VARS ' ]['BE ' ]['sessionTimeout ' ] = 0 ;
3832 $ GLOBALS ['TYPO3_CONF_VARS ' ]['SYS ' ]['requestURIvar ' ] = false ;
3933 $ GLOBALS ['TYPO3_CONF_VARS ' ]['SYS ' ]['systemLog ' ] = 'error_log ' ;
@@ -43,46 +37,26 @@ public static function setDefaultConstants()
4337 $ GLOBALS ['TYPO3_CONF_VARS ' ]['BE ' ]['lockIPv6 ' ] = 0 ;
4438 // @extensionScannerIgnoreLine
4539 $ GLOBALS ['TYPO3_CONF_VARS ' ]['SYS ' ]['enable_DLOG ' ] = false ;
46- if (! defined ('TYPO3_OS ' )) {
40+ if (defined ('TYPO3_OS ' ) === false ) {
4741 define ('TYPO3_OS ' , 'LINUX ' );
4842 }
49- if (! defined ('PATH_site ' )) {
43+ if (defined ('PATH_site ' ) === false ) {
5044 define ('PATH_site ' , self ::getWebRoot ());
5145 }
52- if (! defined ('PATH_thisScript ' )) {
46+ if (defined ('PATH_thisScript ' ) === false ) {
5347 define ('PATH_thisScript ' , self ::getWebRoot () . 'typo3 ' );
5448 }
55- if (! defined ('TYPO3_version ' )) {
49+ if (defined ('TYPO3_version ' ) === false ) {
5650 define ('TYPO3_version ' , '8007000 ' );
5751 }
58- if (! defined ('PHP_EXTENSIONS_DEFAULT ' )) {
52+ if (defined ('PHP_EXTENSIONS_DEFAULT ' ) === false ) {
5953 define ('PHP_EXTENSIONS_DEFAULT ' , 'php ' );
6054 }
61- if (! defined ('FILE_DENY_PATTERN_DEFAULT ' )) {
55+ if (defined ('FILE_DENY_PATTERN_DEFAULT ' ) === false ) {
6256 define ('FILE_DENY_PATTERN_DEFAULT ' , '' );
6357 }
6458 }
6559
66- /**
67- * @param int|null pid
68- * @return void
69- * @SuppressWarnings(PHPMD.Superglobals)
70- */
71- public static function initializeTsfe ($ pid = null )
72- {
73- $ configurationManager = new ConfigurationManager ();
74- $ GLOBALS ['TYPO3_CONF_VARS ' ] = $ configurationManager ->getDefaultConfiguration ();
75- self ::setDefaultConstants ();
76- $ GLOBALS ['TYPO3_CONF_VARS ' ]['SYS ' ]['trustedHostsPattern ' ] = '.* ' ;
77- $ GLOBALS ['TYPO3_CONF_VARS ' ]['FE ' ]['ContentObjects ' ] = [
78- 'TEXT ' => 'TYPO3\CMS\Frontend\ContentObject\TextContentObject ' ,
79- ];
80- $ GLOBALS ['TT ' ] = new TimeTracker ();
81- $ GLOBALS ['TSFE ' ] = new TypoScriptFrontendController ($ GLOBALS ['TYPO3_CONF_VARS ' ], $ pid ?: 1 , 0 , true );
82- $ GLOBALS ['TSFE ' ]->tmpl ->setup ['config. ' ]['sys_language_uid ' ] = '1 ' ;
83- $ GLOBALS ['TSFE ' ]->fe_user ->user ['uid ' ] = 4784 ;
84- }
85-
8660 /**
8761 * @return string
8862 */
0 commit comments