Skip to content

Commit

Permalink
[TASK] Adapt SiteBasedTestCase for v13
Browse files Browse the repository at this point in the history
Use SiteConfiguration/Writer (in v13) from DI instead of
building the instance manually.
  • Loading branch information
bnf committed Oct 17, 2024
1 parent 73e50f5 commit 0191ec4
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions Tests/Functional/SiteBasedTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0191ec4

Please sign in to comment.