diff --git a/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedAliasMapperTest.php b/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedAliasMapperTest.php
index d960d2f5d077a7fe18075dad622799e3bef24a24..ab12770cfbde753b596b08d0262e301f9b04ad1f 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 0eebe9441205dc0fe84563d407067d41d5b37f0a..0803d5b338e70cfa26d83fff771ea20d3ad4f482 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());
         }