‪TYPO3CMS  10.4
ScenarioFTest.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 
47 {
48  protected function ‪setUp(): void
49  {
50  parent::setUp();
51 
53  'acme-com',
54  $this->‪buildSiteConfiguration(1000, 'https://acme.com/'),
55  [
56  $this->‪buildDefaultLanguageConfiguration('EN', 'https://acme.com/en'),
57  $this->‪buildLanguageConfiguration('DE', 'https://acme.com/de'),
58  $this->‪buildLanguageConfiguration('DE-CH', 'https://acme.com/de-ch', ['DE', 'EN']),
59  ]
60  );
61 
62  $this->‪setUpDatabaseWithYamlPayload(__DIR__ . '/Fixtures/ScenarioF.yaml');
63  }
64 
68  public function ‪resolvablePagesDataProvider(): array
69  {
70  return [
71  'about page in DE where page translation exists' => [
72  'url' => 'https://acme.com/de/ueber-uns',
73  'scopes' => [
74  'page/title' => 'DE: Über uns',
75  ],
76  ],
77  'products page in DE where page translation exists' => [
78  'url' => 'https://acme.com/de/produkte',
79  'scopes' => [
80  'page/title' => 'DE: Produkte',
81  ],
82  ],
83  'products page in DE-CH where page translation exists' => [
84  'url' => 'https://acme.com/de-ch/produkte',
85  'scopes' => [
86  'page/title' => 'DE-CH: Produkte',
87  ],
88  ],
89  ];
90  }
91 
99  public function ‪resolvedPagesMatchScopes(string $url, array $scopes): void
100  {
101  $this->‪assertScopes($url, $scopes);
102  }
103 
107  public function ‪pageNotFoundDataProvider(): array
108  {
109  return [
110  'home page in EN' => [
111  'url' => 'https://acme.com/en/hello',
112  ],
113  'home page in DE where page translation does not exist' => [
114  'url' => 'https://acme.com/de/hello',
115  ],
116  'home page in DE-CH where page translation does not exist and is trapped by l18n_cfg' => [
117  'url' => 'https://acme.com/de-ch/hello',
118  ],
119  'about page in EN' => [
120  'url' => 'https://acme.com/en/about-us',
121  ],
122  'about page in DE-CH where page translation does not exist and is trapped by l18n_cfg' => [
123  'url' => 'https://acme.com/de-ch/ueber-uns',
124  ],
125  'products page in EN' => [
126  'url' => 'https://acme.com/en/products',
127  ],
128  ];
129  }
130 
137  public function ‪pageNotFound(string $url): void
138  {
139  $this->‪assertResponseStatusCode($url, 404);
140  }
141 
145  public function ‪menuDataProvider(): array
146  {
147  return [
148  [
149  'url' => 'https://acme.com/de/ueber-uns',
150  'menu' => [
151  ['title' => 'DE: Willkommen', 'link' => '/de/willkommen'],
152  ['title' => 'DE: Über uns', 'link' => '/de/ueber-uns'],
153  ['title' => 'DE: Produkte', 'link' => '/de/produkte'],
154  ],
155  ],
156  [
157  'url' => 'https://acme.com/de/produkte',
158  'menu' => [
159  ['title' => 'DE: Willkommen', 'link' => '/de/willkommen'],
160  ['title' => 'DE: Über uns', 'link' => '/de/ueber-uns'],
161  ['title' => 'DE: Produkte', 'link' => '/de/produkte'],
162  ],
163  ],
164  [
165  'url' => 'https://acme.com/de-ch/produkte',
166  'menu' => [
167  ['title' => 'DE-CH: Produkte', 'link' => '/de-ch/produkte'],
168  // FIXME: Page "EN: Shortcut to welcome" must to be rendered in menu, needs a refactored menu generation
169  ['title' => 'EN: Shortcut to welcome', 'link' => '/de-ch/willkommen'],
170  ],
171  ],
172  ];
173  }
174 
182  public function ‪pageMenuIsRendered(string $url, array $expectedMenu): void
183  {
184  $this->‪assertMenu($url, $expectedMenu);
185  }
186 }
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioFTest\pageNotFound
‪pageNotFound(string $url)
Definition: ScenarioFTest.php:137
‪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\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\AbstractLocalizedPagesTestCase\assertResponseStatusCode
‪assertResponseStatusCode(string $url, int $statusCode)
Definition: AbstractLocalizedPagesTestCase.php:113
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioFTest\pageNotFoundDataProvider
‪array pageNotFoundDataProvider()
Definition: ScenarioFTest.php:107
‪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\ScenarioFTest
Definition: ScenarioFTest.php:47
‪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\ScenarioFTest\setUp
‪setUp()
Definition: ScenarioFTest.php:48
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioFTest\resolvablePagesDataProvider
‪array resolvablePagesDataProvider()
Definition: ScenarioFTest.php:68
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\AbstractLocalizedPagesTestCase\setUpDatabaseWithYamlPayload
‪setUpDatabaseWithYamlPayload(string $pathToYamlFile)
Definition: AbstractLocalizedPagesTestCase.php:65
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioFTest\resolvedPagesMatchScopes
‪resolvedPagesMatchScopes(string $url, array $scopes)
Definition: ScenarioFTest.php:99
‪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\ScenarioFTest\pageMenuIsRendered
‪pageMenuIsRendered(string $url, array $expectedMenu)
Definition: ScenarioFTest.php:182
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioFTest\menuDataProvider
‪array menuDataProvider()
Definition: ScenarioFTest.php:145