‪TYPO3CMS  10.4
ScenarioETest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
45 {
46  protected function ‪setUp(): void
47  {
48  parent::setUp();
49 
51  'acme-com',
52  $this->‪buildSiteConfiguration(1000, 'https://acme.com/'),
53  [
54  $this->‪buildDefaultLanguageConfiguration('EN', 'https://acme.com/en'),
55  $this->‪buildLanguageConfiguration('DE', 'https://acme.com/de'),
56  $this->‪buildLanguageConfiguration('DE-CH', 'https://acme.com/de-ch', ['DE', 'EN']),
57  ]
58  );
59 
60  $this->‪setUpDatabaseWithYamlPayload(__DIR__ . '/Fixtures/ScenarioE.yaml');
61  }
62 
66  public function ‪resolvablePagesDataProvider(): array
67  {
68  return [
69  'about page in DE where page translation exists' => [
70  'url' => 'https://acme.com/de/ueber-uns',
71  'scopes' => [
72  'page/title' => 'DE: Über uns',
73  ],
74  ],
75  'about page in DE-CH where page translation does not exist' => [
76  'url' => 'https://acme.com/de-ch/ueber-uns',
77  'scopes' => [
78  'page/title' => 'DE: Über uns',
79  ],
80  ],
81  'about page in DE-CH with EN slug' => [
82  'url' => 'https://acme.com/de-ch/about-us',
83  'scopes' => [
84  'page/title' => 'DE: Über uns',
85  ],
86  ],
87  ];
88  }
89 
97  public function ‪resolvedPagesMatchScopes(string $url, array $scopes): void
98  {
99  $this->‪assertScopes($url, $scopes);
100  }
101 
105  public function ‪pageNotFoundDataProvider(): array
106  {
107  return [
108  'home page in EN' => [
109  'url' => 'https://acme.com/en/hello',
110  ],
111  'home page in DE where page translation does not exist' => [
112  'url' => 'https://acme.com/de/hello',
113  ],
114  'home page in DE-CH where page translation does not exist and is trapped by l18n_cfg' => [
115  'url' => 'https://acme.com/de-ch/hello',
116  ],
117  'about page in EN' => [
118  'url' => 'https://acme.com/en/about-us',
119  ],
120  'about page in DE with EN slug' => [
121  'url' => 'https://acme.com/de/about-us',
122  ],
123  ];
124  }
125 
132  public function ‪pageNotFound(string $url): void
133  {
134  $this->‪assertResponseStatusCode($url, 404);
135  }
136 
140  public function ‪menuDataProvider(): array
141  {
142  return [
143  [
144  'url' => 'https://acme.com/de/ueber-uns',
145  'menu' => [
146  ['title' => 'DE: Über uns', 'link' => '/de/ueber-uns'],
147  ['title' => 'DE: Produkte', 'link' => '/de/produkte'],
148  ],
149  ],
150  [
151  'url' => 'https://acme.com/de-ch/ueber-uns',
152  'menu' => [
153  ['title' => 'DE: Über uns', 'link' => '/de-ch/ueber-uns'],
154  ['title' => 'DE: Produkte', 'link' => '/de-ch/produkte'],
155  ['title' => 'EN: Shortcut to welcome', 'link' => '/de-ch/hello'],
156  ],
157  ],
158  [
159  'url' => 'https://acme.com/de-ch/about-us',
160  'menu' => [
161  ['title' => 'DE: Über uns', 'link' => '/de-ch/ueber-uns'],
162  ['title' => 'DE: Produkte', 'link' => '/de-ch/produkte'],
163  ['title' => 'EN: Shortcut to welcome', 'link' => '/de-ch/hello'],
164  ],
165  ],
166  ];
167  }
168 
176  public function ‪pageMenuIsRendered(string $url, array $expectedMenu): void
177  {
178  $this->‪assertMenu($url, $expectedMenu);
179  }
180 }
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioETest\setUp
‪setUp()
Definition: ScenarioETest.php:46
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioETest\pageMenuIsRendered
‪pageMenuIsRendered(string $url, array $expectedMenu)
Definition: ScenarioETest.php:176
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\AbstractLocalizedPagesTestCase\assertScopes
‪assertScopes(string $url, array $scopes)
Definition: AbstractLocalizedPagesTestCase.php:90
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildLanguageConfiguration
‪array buildLanguageConfiguration(string $identifier, string $base, array $fallbackIdentifiers=[], string $fallbackType=null)
Definition: SiteBasedTestTrait.php:142
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioETest\resolvablePagesDataProvider
‪array resolvablePagesDataProvider()
Definition: ScenarioETest.php:66
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\writeSiteConfiguration
‪writeSiteConfiguration(string $identifier, array $site=[], array $languages=[], array $errorHandling=[])
Definition: SiteBasedTestTrait.php:58
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering
Definition: AbstractLocalizedPagesTestCase.php:18
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\AbstractLocalizedPagesTestCase
Definition: AbstractLocalizedPagesTestCase.php:29
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioETest\pageNotFoundDataProvider
‪array pageNotFoundDataProvider()
Definition: ScenarioETest.php:105
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\AbstractLocalizedPagesTestCase\assertResponseStatusCode
‪assertResponseStatusCode(string $url, int $statusCode)
Definition: AbstractLocalizedPagesTestCase.php:113
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioETest\pageNotFound
‪pageNotFound(string $url)
Definition: ScenarioETest.php:132
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioETest\resolvedPagesMatchScopes
‪resolvedPagesMatchScopes(string $url, array $scopes)
Definition: ScenarioETest.php:97
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildDefaultLanguageConfiguration
‪array buildDefaultLanguageConfiguration(string $identifier, string $base)
Definition: SiteBasedTestTrait.php:124
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\AbstractLocalizedPagesTestCase\assertMenu
‪assertMenu(string $url, array $expectation)
Definition: AbstractLocalizedPagesTestCase.php:128
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\AbstractLocalizedPagesTestCase\setUpDatabaseWithYamlPayload
‪setUpDatabaseWithYamlPayload(string $pathToYamlFile)
Definition: AbstractLocalizedPagesTestCase.php:65
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioETest
Definition: ScenarioETest.php:45
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildSiteConfiguration
‪array buildSiteConfiguration(int $rootPageId, string $base='')
Definition: SiteBasedTestTrait.php:109
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioETest\menuDataProvider
‪array menuDataProvider()
Definition: ScenarioETest.php:140