[BUGFIX] Unit tests: Define TYPO3_REQUESTTYPE 25/54925/3
authorChristian Kuhn <lolli@schwarzbu.ch>
Sun, 3 Dec 2017 19:48:21 +0000 (20:48 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 3 Dec 2017 20:00:05 +0000 (21:00 +0100)
Unit test boostrap does not initialize constants
TYPO3_REQUESTTYPE and TYPO3_REQUESTTYPE_*, but various
tests rely on this basic constants being properly defined
in core v7. With PHP 7.2, accessing undefined connstants
throws warnings.
Patch makes according bootstrap method public and calls
it during unit test bootstrap.

Change-Id: I450e440694385244c554adef00a9c74135d457f5
Resolves: #83211
Releases: 7.6
Reviewed-on: https://review.typo3.org/54925
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: TYPO3com <no-reply@typo3.com>
typo3/sysext/core/Build/UnitTestsBootstrap.php
typo3/sysext/core/Classes/Core/Bootstrap.php

index 4ec5fe4..bfebaa8 100644 (file)
@@ -134,6 +134,10 @@ class UnitTestsBootstrap
         define('TYPO3_cliMode', true);
         putenv('TYPO3_CONTEXT=Testing');
 
+        // Set TYPO3_AJAX and define TYPO3_REQUESSTTYPE's to prevent PHP 7.2 warnings
+        $GLOBALS['TYPO3_AJAX'] = '';
+        Bootstrap::getInstance()->defineTypo3RequestTypes();
+
         return $this;
     }
 
index 145644f..91b28c4 100644 (file)
@@ -738,7 +738,7 @@ class Bootstrap
      *
      * @return Bootstrap
      */
-    protected function defineTypo3RequestTypes()
+    public function defineTypo3RequestTypes()
     {
         define('TYPO3_REQUESTTYPE_FE', 1);
         define('TYPO3_REQUESTTYPE_BE', 2);