‪TYPO3CMS  9.5
ScenarioDTest.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 
44 {
45  protected function ‪setUp(): void
46  {
47  parent::setUp();
48 
50  'acme-com',
51  $this->‪buildSiteConfiguration(1000, 'https://acme.com/'),
52  [
53  $this->‪buildDefaultLanguageConfiguration('EN', 'https://acme.com/en'),
54  $this->‪buildLanguageConfiguration('DE', 'https://acme.com/de'),
55  $this->‪buildLanguageConfiguration('DE-CH', 'https://acme.com/de-ch', ['DE', 'EN']),
56  ]
57  );
58 
59  $this->‪setUpDatabaseWithYamlPayload(__DIR__ . '/Fixtures/ScenarioD.yaml');
60  }
61 
65  public function ‪resolvablePagesDataProvider(): array
66  {
67  return [
68  'home page in EN' => [
69  'url' => 'https://acme.com/en/hello',
70  'scopes' => [
71  'page/title' => 'EN: Welcome',
72  ],
73  ],
74  'about page in EN' => [
75  'url' => 'https://acme.com/en/about-us',
76  'scopes' => [
77  'page/title' => 'EN: About us',
78  ],
79  ],
80  'about page in DE where page translation exists' => [
81  'url' => 'https://acme.com/de/ueber-uns',
82  'scopes' => [
83  'page/title' => 'DE: Über uns',
84  ],
85  ],
86  'about page in DE-CH where page translation exists' => [
87  'url' => 'https://acme.com/de-ch/ueber-uns',
88  'scopes' => [
89  'page/title' => 'DE-CH: Über uns',
90  ],
91  ],
92  ];
93  }
94 
102  public function ‪resolvedPagesMatchScopes(string $url, array $scopes): void
103  {
104  $this->‪assertScopes($url, $scopes);
105  }
106 
110  public function ‪pageNotFoundDataProvider(): array
111  {
112  return [
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  'DE-CH shortcut to home page where page translation does not exist and is trapped by l18n_cfg' => [
122  'url' => 'https://acme.com/de-ch/shortcut-to-welcome',
123  'exception' => PageNotFoundException::class,
124  ]
125  ];
126  }
127 
135  public function ‪requestsThrowException(string $url, string $exception): void
136  {
137  $this->‪assertException($url, $exception);
138  }
139 
143  public function ‪menuDataProvider(): array
144  {
145  return [
146  [
147  'url' => 'https://acme.com/en/hello',
148  'menu' => [
149  ['title' => 'EN: Welcome', 'link' => '/en/hello'],
150  ['title' => 'EN: About us', 'link' => '/en/about-us'],
151  ['title' => 'EN: Products', 'link' => '/en/products'],
152  ['title' => 'EN: Shortcut to welcome', 'link' => '/en/hello'],
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  ],
163  ],
164  [
165  'url' => 'https://acme.com/de/ueber-uns',
166  'menu' => [
167  ['title' => 'DE: Über uns', 'link' => '/de/ueber-uns'],
168  ],
169  ],
170  [
171  'url' => 'https://acme.com/de-ch/ueber-uns',
172  'menu' => [
173  ['title' => 'DE-CH: Über uns', 'link' => '/de-ch/ueber-uns'],
174  ['title' => 'DE-CH: Produkte', 'link' => '/de-ch/produkte'],
175  ['title' => 'EN: Shortcut to welcome', 'link' => ''],
176  ],
177  ],
178  ];
179  }
180 
188  public function ‪pageMenuIsRendered(string $url, array $expectedMenu): void
189  {
190  $this->‪assertMenu($url, $expectedMenu);
191  }
192 }
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioDTest\pageNotFoundDataProvider
‪array pageNotFoundDataProvider()
Definition: ScenarioDTest.php:110
‪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\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioDTest
Definition: ScenarioDTest.php:44
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioDTest\resolvablePagesDataProvider
‪array resolvablePagesDataProvider()
Definition: ScenarioDTest.php:65
‪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\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\ScenarioDTest\requestsThrowException
‪requestsThrowException(string $url, string $exception)
Definition: ScenarioDTest.php:135
‪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\ScenarioDTest\menuDataProvider
‪array menuDataProvider()
Definition: ScenarioDTest.php:143
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioDTest\setUp
‪setUp()
Definition: ScenarioDTest.php:45
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\AbstractLocalizedPagesTestCase\setUpDatabaseWithYamlPayload
‪setUpDatabaseWithYamlPayload(string $pathToYamlFile)
Definition: AbstractLocalizedPagesTestCase.php:61
‪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\ScenarioDTest\pageMenuIsRendered
‪pageMenuIsRendered(string $url, array $expectedMenu)
Definition: ScenarioDTest.php:188
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioDTest\resolvedPagesMatchScopes
‪resolvedPagesMatchScopes(string $url, array $scopes)
Definition: ScenarioDTest.php:102