From e60840c796e494734114f002673d2db72b36209d Mon Sep 17 00:00:00 2001
From: Oliver Hader <oliver@typo3.org>
Date: Thu, 2 Apr 2020 12:30:24 +0200
Subject: [PATCH] [BUGFIX] Correctly initialize SiteConfiguration in functional
 tests

SiteConfiguration requires configuration path to be defined. Since
this class is a singleton it might happen that SiteFinder created
an instance already.

Resolves: #90929
Releases: master
Change-Id: I99c891c7b48c11a79003b410c1efa4da82bcd817
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64050
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
---
 .../Functional/Routing/Aspect/PersistedAliasMapperTest.php   | 5 +++--
 .../Functional/Routing/Aspect/PersistedPatternMapperTest.php | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedAliasMapperTest.php b/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedAliasMapperTest.php
index d960d2f5d077..ab12770cfbde 100644
--- a/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedAliasMapperTest.php
+++ b/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedAliasMapperTest.php
@@ -322,8 +322,9 @@ class PersistedAliasMapperTest extends FunctionalTestCase
     {
         try {
             // ensure no previous site configuration influences the test
-            GeneralUtility::rmdir($this->instancePath . '/typo3conf/sites/' . $site->getIdentifier(), true);
-            GeneralUtility::makeInstance(SiteConfiguration::class)->write($site->getIdentifier(), $site->getConfiguration());
+            $path = $this->instancePath . '/typo3conf/sites';
+            GeneralUtility::rmdir($path . '/' . $site->getIdentifier(), true);
+            GeneralUtility::makeInstance(SiteConfiguration::class, $path)->write($site->getIdentifier(), $site->getConfiguration());
         } catch (\Exception $exception) {
             self::markTestSkipped($exception->getMessage());
         }
diff --git a/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedPatternMapperTest.php b/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedPatternMapperTest.php
index 0eebe9441205..0803d5b338e7 100644
--- a/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedPatternMapperTest.php
+++ b/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedPatternMapperTest.php
@@ -326,8 +326,9 @@ class PersistedPatternMapperTest extends FunctionalTestCase
     {
         try {
             // ensure no previous site configuration influences the test
-            GeneralUtility::rmdir($this->instancePath . '/typo3conf/sites/' . $site->getIdentifier(), true);
-            GeneralUtility::makeInstance(SiteConfiguration::class)->write($site->getIdentifier(), $site->getConfiguration());
+            $path = $this->instancePath . '/typo3conf/sites';
+            GeneralUtility::rmdir($path . '/' . $site->getIdentifier(), true);
+            GeneralUtility::makeInstance(SiteConfiguration::class, $path)->write($site->getIdentifier(), $site->getConfiguration());
         } catch (\Exception $exception) {
             self::markTestSkipped($exception->getMessage());
         }
-- 
GitLab