From 0191ec4b372e8ef4ef286258f80a51bf55a20f30 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Wed, 16 Oct 2024 10:54:30 +0200 Subject: [PATCH] [TASK] Adapt SiteBasedTestCase for v13 Use SiteConfiguration/Writer (in v13) from DI instead of building the instance manually. --- Tests/Functional/SiteBasedTestCase.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Tests/Functional/SiteBasedTestCase.php b/Tests/Functional/SiteBasedTestCase.php index 1d24d050..8ef30d9c 100644 --- a/Tests/Functional/SiteBasedTestCase.php +++ b/Tests/Functional/SiteBasedTestCase.php @@ -9,8 +9,8 @@ namespace T3G\AgencyPack\Blog\Tests\Functional; -use Psr\EventDispatcher\EventDispatcherInterface; use TYPO3\CMS\Core\Configuration\SiteConfiguration; +use TYPO3\CMS\Core\Configuration\SiteWriter; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -38,14 +38,6 @@ protected function createTestSite(): void $this->importCSVDataSet(__DIR__ . '/Fixtures/Site/tt_content.csv'); $identifier = 'test'; - $arguments = []; - $arguments[] = $this->instancePath . '/typo3conf/sites/'; - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() >= 12) { - $arguments[] = $this->get(EventDispatcherInterface::class); - } - $arguments[] = $this->get('cache.core'); - $siteConfiguration = new SiteConfiguration(...$arguments); - $configuration = [ 'websiteTitle' => 'Simple Test Site', 'rootPageId' => '1', @@ -73,7 +65,11 @@ protected function createTestSite(): void ]; GeneralUtility::rmdir($this->instancePath . '/typo3conf/sites/' . $identifier, true); - $siteConfiguration->write($identifier, $configuration); + if ((new Typo3Version())->getMajorVersion() >= 13) { + $this->get(SiteWriter::class)->write($identifier, $configuration); + } else { + $this->get(SiteConfiguration::class)->write($identifier, $configuration); + } } protected function renderFluidTemplateInTestSite(string $template, array $instructions = []): string