2 declare(strict_types = 1);
18 use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerFactory;
19 use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\Scenario\DataHandlerWriter;
20 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
21 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequestContext;
22 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\ResponseContent;
27 'EN' => [
'id' => 0,
'title' =>
'English',
'locale' =>
'en_US.UTF8',
'iso' =>
'en',
'hrefLang' =>
'en-US',
'direction' =>
''],
28 'DE' => [
'id' => 1,
'title' =>
'German',
'locale' =>
'de_DE.UTF8',
'iso' =>
'de',
'hrefLang' =>
'de-DE',
'direction' =>
''],
29 'DE-CH' => [
'id' => 2,
'title' =>
'Swiss German',
'locale' =>
'de_CH.UTF8',
'iso' =>
'de',
'hrefLang' =>
'de-CH',
'direction' =>
''],
35 protected $siteTitle =
'A Company that Manufactures Everything Inc';
44 parent::setUpBeforeClass();
45 static::initializeDatabaseSnapshot();
50 static::destroyDatabaseSnapshot();
51 parent::tearDownAfterClass();
54 protected function setUp(): void
59 $this->internalRequestContext = (
new InternalRequestContext())
60 ->withGlobalSettings([
'TYPO3_CONF_VARS' => static::TYPO3_CONF_VARS]);
65 $this->withDatabaseSnapshot(
function () use ($pathToYamlFile) {
66 $backendUser = $this->setUpBackendUserFromFixture(1);
69 $factory = DataHandlerFactory::fromYamlFile($pathToYamlFile);
70 $writer = DataHandlerWriter::withBackendUser($backendUser);
71 $writer->invokeFactory($factory);
72 static::failIfArrayIsNotEmpty(
80 unset($this->internalRequestContext);
88 protected function assertScopes(
string $url, array $scopes): void
90 $this->setUpFrontendRootPage(
92 [
'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.typoscript'],
94 'title' =>
'ACME Root',
95 'sitetitle' => $this->siteTitle,
99 $response = $this->executeFrontendRequest(
new InternalRequest($url), $this->internalRequestContext);
100 $responseStructure = ResponseContent::fromString((
string)$response->getBody());
102 foreach ($scopes as $scopePath => $expectedScopeValue) {
103 static::assertSame($expectedScopeValue, $responseStructure->getScopePath($scopePath));
113 $this->setUpFrontendRootPage(
115 [
'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.typoscript']
118 $this->expectException($exception);
119 $this->executeFrontendRequest(
new InternalRequest($url), $this->internalRequestContext);
126 protected function assertMenu(
string $url, array $expectation): void
128 $this->setUpFrontendRootPage(
130 [
'typo3/sysext/frontend/Tests/Functional/SiteHandling/Fixtures/LinkGenerator.typoscript'],
132 'title' =>
'ACME Root',
133 'sitetitle' => $this->siteTitle,
137 $response = $this->executeFrontendRequest(
138 (
new InternalRequest($url))
140 $this->createHierarchicalMenuProcessorInstruction([
144 'includeSpacer' => 1,
145 'titleField' =>
'title',
149 $this->internalRequestContext
152 $json = json_decode((
string)$response->getBody(),
true);
153 $json = $this->filterMenu($json);
155 static::assertSame($expectation, $json);