[TASK] Make usage of TYPO3_PATH_WEB failsafe 76/42676/3
authorAlexander Schnitzler <git@alexanderschnitzler.de>
Mon, 17 Aug 2015 09:15:14 +0000 (11:15 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Mon, 17 Aug 2015 10:05:19 +0000 (12:05 +0200)
Using the TYPO3_PATH_WEB env var with a trailing
slash leads to failing unit/functional tests.

Trimming and appending a slash makes the usage
fail safe.

Releases: master
Resolves: #69124
Change-Id: I5048de4c9d35400c148cb5c40cf516d0d684b47a
Reviewed-on: http://review.typo3.org/42676
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/core/Build/FunctionalTestsBootstrap.php
typo3/sysext/core/Build/UnitTestsBootstrap.php

index 61417d6..d396e2b 100644 (file)
@@ -118,12 +118,11 @@ class FunctionalTestsBootstrap {
         */
        protected function getWebRoot() {
                if (getenv('TYPO3_PATH_WEB')) {
-                       $webRoot = getenv('TYPO3_PATH_WEB') . '/';
+                       $webRoot = getenv('TYPO3_PATH_WEB');
                } else {
-                       $webRoot = getcwd() . '/';
+                       $webRoot = getcwd();
                }
-
-               return strtr($webRoot, '\\', '/');
+               return rtrim(strtr($webRoot, '\\', '/'), '/') . '/';
        }
 }
 
index 806cd64..e017900 100644 (file)
@@ -105,12 +105,11 @@ class UnitTestsBootstrap {
         */
        protected function getWebRoot() {
                if (getenv('TYPO3_PATH_WEB')) {
-                       $webRoot = getenv('TYPO3_PATH_WEB') . '/';
+                       $webRoot = getenv('TYPO3_PATH_WEB');
                } else {
-                       $webRoot = getcwd() . '/';
+                       $webRoot = getcwd();
                }
-
-               return strtr($webRoot, '\\', '/');
+               return rtrim(strtr($webRoot, '\\', '/'), '/') . '/';
        }
 
        /**