diff --git a/application/utils.inc.php b/application/utils.inc.php index dbb595d72b..6086f3874a 100644 --- a/application/utils.inc.php +++ b/application/utils.inc.php @@ -155,6 +155,8 @@ class utils private static $iNextId = 0; + private static $m_sAppRootUrl = null; + protected static function LoadParamFile($sParamFile) { if (!file_exists($sParamFile)) { @@ -992,7 +994,7 @@ class utils */ public static function GetAbsoluteUrlAppRoot($bForceTrustProxy = false) { - static $sUrl = null; + $sUrl = static::$m_sAppRootUrl; if ($sUrl === null || $bForceTrustProxy) { $sUrl = self::GetConfig()->Get('app_root_url'); @@ -1013,8 +1015,9 @@ class utils } $sUrl = str_replace(SERVER_NAME_PLACEHOLDER, $sServerName, $sUrl); } + static::$m_sAppRootUrl = $sUrl; } - return $sUrl; + return static::$m_sAppRootUrl; } /** diff --git a/tests/php-unit-tests/unitary-tests/application/utilsTest.php b/tests/php-unit-tests/unitary-tests/application/utilsTest.php index 116f621c16..790991ab9f 100644 --- a/tests/php-unit-tests/unitary-tests/application/utilsTest.php +++ b/tests/php-unit-tests/unitary-tests/application/utilsTest.php @@ -25,7 +25,6 @@ use Combodo\iTop\Test\UnitTest\ItopTestCase; use utils; /** - * @runClassInSeparateProcess * @covers utils */ class utilsTest extends ItopTestCase @@ -245,7 +244,6 @@ class utilsTest extends ItopTestCase } /** - * @runInSeparateProcess * @dataProvider GetAbsoluteUrlAppRootPersistency */ public function testGetAbsoluteUrlAppRootPersistency($bBehindReverseProxy,$bForceTrustProxy1 ,$sExpectedAppRootUrl1,$bForceTrustProxy2 , $sExpectedAppRootUrl2,$bForceTrustProxy3 , $sExpectedAppRootUrl3) @@ -274,6 +272,9 @@ class utilsTest extends ItopTestCase $this->assertEquals($sExpectedAppRootUrl2, utils::GetAbsoluteUrlAppRoot($bForceTrustProxy2)); $this->assertEquals($sExpectedAppRootUrl3, utils::GetAbsoluteUrlAppRoot($bForceTrustProxy3)); + + // Leave the place clean + static::SetNonPublicStaticProperty('utils', 'm_sAppRootUrl', null); }