Skip to content

Commit

Permalink
[BUGFIX] Ensure to take test instance as class mode instance
Browse files Browse the repository at this point in the history
The bugfix backport to ensure correct system environment path
building to fix issue TYPO3#577 missed to correctly set the flag
for non-composer mode for TYPO3 v12 and lead to wrong path
calculations and followup issues within functional tests.

This is fixed by handing over a correct override value within
the functional test bootstrap.

[1] TYPO3#577
[2] TYPO3#633

Resolves: TYPO3#658
Related: TYPO3#633
Related: TYPO3@409c2b8
Releases: 8

Backported from dd7505b
  • Loading branch information
sbuerk committed Dec 4, 2024
1 parent 8095aa4 commit f4183c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions Classes/Core/SystemEnvironmentBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@
*/
class SystemEnvironmentBuilder extends CoreSystemEnvironmentBuilder
{
public static function run(int $entryPointLevel = 0, int $requestType = CoreSystemEnvironmentBuilder::REQUESTTYPE_FE, bool $composerMode = false)
protected static ?bool $composerMode = null;
public static function run(int $entryPointLevel = 0, int $requestType = CoreSystemEnvironmentBuilder::REQUESTTYPE_FE, ?bool $composerMode = null)
{
static::$composerMode = $composerMode;
CoreSystemEnvironmentBuilder::run($entryPointLevel, $requestType);
Environment::initialize(
Environment::getContext(),
Environment::isCli(),
$composerMode,
static::usesComposerClassLoading(),
Environment::getProjectPath(),
Environment::getPublicPath(),
Environment::getVarPath(),
Expand All @@ -55,4 +57,9 @@ public static function run(int $entryPointLevel = 0, int $requestType = CoreSyst
Environment::isWindows() ? 'WINDOWS' : 'UNIX'
);
}

protected static function usesComposerClassLoading(): bool
{
return static::$composerMode ?? parent::usesComposerClassLoading();
}
}
2 changes: 1 addition & 1 deletion Classes/Core/Testbase.php
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ public function setUpBasicTypo3Bootstrap($instancePath): ContainerInterface
GeneralUtility::purgeInstances();

$classLoader = require $this->getPackagesPath() . '/autoload.php';
SystemEnvironmentBuilder::run(1, SystemEnvironmentBuilder::REQUESTTYPE_BE | SystemEnvironmentBuilder::REQUESTTYPE_CLI);
SystemEnvironmentBuilder::run(1, SystemEnvironmentBuilder::REQUESTTYPE_BE | SystemEnvironmentBuilder::REQUESTTYPE_CLI, false);
$container = Bootstrap::init($classLoader);
// Make sure output is not buffered, so command-line output can take place and
// phpunit does not whine about changed output bufferings in tests.
Expand Down

0 comments on commit f4183c9

Please sign in to comment.