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