‪TYPO3CMS  10.4
ScenarioDTest.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/ScenarioD.yaml');
63  }
64 
68  public function ‪resolvablePagesDataProvider(): array
69  {
70  return [
71  'home page in EN' => [
72  'url' => 'https://acme.com/en/hello',
73  'scopes' => [
74  'page/title' => 'EN: Welcome',
75  ],
76  ],
77  'about page in EN' => [
78  'url' => 'https://acme.com/en/about-us',
79  'scopes' => [
80  'page/title' => 'EN: About us',
81  ],
82  ],
83  'about page in DE where page translation exists' => [
84  'url' => 'https://acme.com/de/ueber-uns',
85  'scopes' => [
86  'page/title' => 'DE: Über uns',
87  ],
88  ],
89  'about page in DE-CH where page translation exists' => [
90  'url' => 'https://acme.com/de-ch/ueber-uns',
91  'scopes' => [
92  'page/title' => 'DE-CH: Über uns',
93  ],
94  ],
95  ];
96  }
97 
105  public function ‪resolvedPagesMatchScopes(string $url, array $scopes): void
106  {
107  $this->‪assertScopes($url, $scopes);
108  }
109 
113  public function ‪pageNotFoundDataProvider(): array
114  {
115  return [
116  'home page in DE where page translation does not exist' => [
117  'url' => 'https://acme.com/de/hello',
118  ],
119  'home page in DE-CH where page translation does not exist and is trapped by l18n_cfg' => [
120  'url' => 'https://acme.com/de-ch/hello',
121  ],
122  'DE-CH shortcut to home page where page translation does not exist and is trapped by l18n_cfg' => [
123  'url' => 'https://acme.com/de-ch/shortcut-to-welcome',
124  ]
125  ];
126  }
127 
134  public function ‪pageNotFound(string $url): void
135  {
136  $this->‪assertResponseStatusCode($url, 404);
137  }
138 
142  public function ‪menuDataProvider(): array
143  {
144  return [
145  [
146  'url' => 'https://acme.com/en/hello',
147  'menu' => [
148  ['title' => 'EN: Welcome', 'link' => '/en/hello'],
149  ['title' => 'EN: About us', 'link' => '/en/about-us'],
150  ['title' => 'EN: Products', 'link' => '/en/products'],
151  ['title' => 'EN: Shortcut to welcome', 'link' => '/en/hello'],
152  ['title' => 'EN: Company', 'link' => '/en/company'],
153  ],
154  ],
155  [
156  'url' => 'https://acme.com/en/about-us',
157  'menu' => [
158  ['title' => 'EN: Welcome', 'link' => '/en/hello'],
159  ['title' => 'EN: About us', 'link' => '/en/about-us'],
160  ['title' => 'EN: Products', 'link' => '/en/products'],
161  ['title' => 'EN: Shortcut to welcome', 'link' => '/en/hello'],
162  ['title' => 'EN: Company', 'link' => '/en/company'],
163  ],
164  ],
165  [
166  'url' => 'https://acme.com/de/ueber-uns',
167  'menu' => [
168  ['title' => 'DE: Über uns', 'link' => '/de/ueber-uns'],
169  ['title' => 'DE: Unternehmen', 'link' => '/de/ueber-uns'],
170  ],
171  ],
172  [
173  'url' => 'https://acme.com/de-ch/ueber-uns',
174  'menu' => [
175  ['title' => 'DE-CH: Über uns', 'link' => '/de-ch/ueber-uns'],
176  ['title' => 'DE-CH: Produkte', 'link' => '/de-ch/produkte'],
177  ['title' => 'EN: Shortcut to welcome', 'link' => ''],
178  ],
179  ],
180  ];
181  }
182 
190  public function ‪pageMenuIsRendered(string $url, array $expectedMenu): void
191  {
192  $this->‪assertMenu($url, $expectedMenu);
193  }
194 }
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioDTest\pageNotFoundDataProvider
‪array pageNotFoundDataProvider()
Definition: ScenarioDTest.php:113
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\AbstractLocalizedPagesTestCase\assertScopes
‪assertScopes(string $url, array $scopes)
Definition: AbstractLocalizedPagesTestCase.php:90
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioDTest
Definition: ScenarioDTest.php:47
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioDTest\resolvablePagesDataProvider
‪array resolvablePagesDataProvider()
Definition: ScenarioDTest.php:68
‪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\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\ScenarioDTest\pageNotFound
‪pageNotFound(string $url)
Definition: ScenarioDTest.php:134
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioDTest\menuDataProvider
‪array menuDataProvider()
Definition: ScenarioDTest.php:142
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioDTest\setUp
‪setUp()
Definition: ScenarioDTest.php:48
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\AbstractLocalizedPagesTestCase\setUpDatabaseWithYamlPayload
‪setUpDatabaseWithYamlPayload(string $pathToYamlFile)
Definition: AbstractLocalizedPagesTestCase.php:65
‪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\ScenarioDTest\pageMenuIsRendered
‪pageMenuIsRendered(string $url, array $expectedMenu)
Definition: ScenarioDTest.php:190
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioDTest\resolvedPagesMatchScopes
‪resolvedPagesMatchScopes(string $url, array $scopes)
Definition: ScenarioDTest.php:105