Commit 2d416691 authored by Oliver Hader's avatar Oliver Hader Committed by Oliver Hader
Browse files

[TASK] Initialize & cleanup FrontendLoginControllerTest environment

`FrontendLoginControllerTest` environment (host, script-name, ...) is
not initialized and cleaned up properly. Implementation in TYPO3 v10 is
different and does not rely on `GeneralUtility::getIndpEnv` anymore.
That's why it's just targeted for TYPO3 v9.

Resolves: #93705
Releases: 9.5
Change-Id: Ib22f162d95cef91d28800bdf059ee71a7d706e30
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/68343

Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Oliver Hader's avatarOliver Hader <oliver.hader@typo3.org>
Reviewed-by: Oliver Hader's avatarOliver Hader <oliver.hader@typo3.org>
parent 9b9b3857
......@@ -19,6 +19,7 @@ use Prophecy\Argument;
use Prophecy\Prophecy\ObjectProphecy;
use Psr\Log\NullLogger;
use TYPO3\CMS\Core\Authentication\LoginType;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder;
......@@ -88,6 +89,7 @@ class FrontendLoginControllerTest extends UnitTestCase
// setUpDatabaseMock() prepares some instances via addInstance(), but not all
// tests use that instance. purgeInstances() removes left overs
GeneralUtility::purgeInstances();
GeneralUtility::flushInternalRuntimeCaches();
parent::tearDown();
}
......@@ -96,8 +98,20 @@ class FrontendLoginControllerTest extends UnitTestCase
*/
protected function setUpFakeSitePathAndHost()
{
$_SERVER['ORIG_PATH_INFO'] = $_SERVER['PATH_INFO'] = $_SERVER['ORIG_SCRIPT_NAME'] = $_SERVER['SCRIPT_NAME'] = $this->testSitePath . TYPO3_mainDir;
$_SERVER['ORIG_PATH_INFO'] = $_SERVER['PATH_INFO'] = $_SERVER['ORIG_SCRIPT_NAME'] = $_SERVER['SCRIPT_NAME'] = $this->testSitePath . TYPO3_mainDir . 'index.php';
$_SERVER['HTTP_HOST'] = $this->testHostName;
Environment::initialize(
Environment::getContext(),
true,
false,
Environment::getProjectPath(),
Environment::getPublicPath(),
Environment::getVarPath(),
Environment::getConfigPath(),
Environment::getBackendPath() . '/index.php',
Environment::isWindows() ? 'WINDOWS' : 'UNIX'
);
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment