‪TYPO3CMS  9.5
ScenarioFTest.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 
48 {
49  protected function ‪setUp(): void
50  {
51  parent::setUp();
52 
54  'acme-com',
55  $this->‪buildSiteConfiguration(1000, 'https://acme.com/'),
56  [
57  $this->‪buildDefaultLanguageConfiguration('EN', 'https://acme.com/en'),
58  $this->‪buildLanguageConfiguration('DE', 'https://acme.com/de'),
59  $this->‪buildLanguageConfiguration('DE-CH', 'https://acme.com/de-ch', ['DE', 'EN']),
60  ]
61  );
62 
63  $this->‪setUpDatabaseWithYamlPayload(__DIR__ . '/Fixtures/ScenarioF.yaml');
64  }
65 
69  public function ‪resolvablePagesDataProvider(): array
70  {
71  return [
72  'about page in DE where page translation exists' => [
73  'url' => 'https://acme.com/de/ueber-uns',
74  'scopes' => [
75  'page/title' => 'DE: Über uns',
76  ],
77  ],
78  'products page in DE where page translation exists' => [
79  'url' => 'https://acme.com/de/produkte',
80  'scopes' => [
81  'page/title' => 'DE: Produkte',
82  ],
83  ],
84  'products page in DE-CH where page translation exists' => [
85  'url' => 'https://acme.com/de-ch/produkte',
86  'scopes' => [
87  'page/title' => 'DE-CH: Produkte',
88  ],
89  ],
90  ];
91  }
92 
100  public function ‪resolvedPagesMatchScopes(string $url, array $scopes): void
101  {
102  $this->‪assertScopes($url, $scopes);
103  }
104 
108  public function ‪pageNotFoundDataProvider(): array
109  {
110  return [
111  'home page in EN' => [
112  'url' => 'https://acme.com/en/hello',
113  'exception' => PageNotFoundException::class,
114  ],
115  'home page in DE where page translation does not exist' => [
116  'url' => 'https://acme.com/de/hello',
117  'exception' => PageNotFoundException::class,
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  'exception' => PageNotFoundException::class,
122  ],
123  'about page in EN' => [
124  'url' => 'https://acme.com/en/about-us',
125  'exception' => PageNotFoundException::class,
126  ],
127  'about page in DE-CH where page translation does not exist and is trapped by l18n_cfg' => [
128  'url' => 'https://acme.com/de-ch/ueber-uns',
129  'exception' => PageNotFoundException::class,
130  ],
131  'products page in EN' => [
132  'url' => 'https://acme.com/en/products',
133  'exception' => PageNotFoundException::class,
134  ],
135  ];
136  }
137 
145  public function ‪requestsThrowException(string $url, string $exception): void
146  {
147  $this->‪assertException($url, $exception);
148  }
149 
153  public function ‪menuDataProvider(): array
154  {
155  return [
156  [
157  'url' => 'https://acme.com/de/ueber-uns',
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/produkte',
166  'menu' => [
167  ['title' => 'DE: Willkommen', 'link' => '/de/willkommen'],
168  ['title' => 'DE: Über uns', 'link' => '/de/ueber-uns'],
169  ['title' => 'DE: Produkte', 'link' => '/de/produkte'],
170  ],
171  ],
172  [
173  'url' => 'https://acme.com/de-ch/produkte',
174  'menu' => [
175  ['title' => 'DE-CH: Produkte', 'link' => '/de-ch/produkte'],
176  // FIXME: Page "EN: Shortcut to welcome" must to be rendered in menu, needs a refactored menu generation
177  ['title' => 'EN: Shortcut to welcome', 'link' => '/de-ch/willkommen'],
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\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\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\ScenarioFTest\pageNotFoundDataProvider
‪array pageNotFoundDataProvider()
Definition: ScenarioFTest.php:108
‪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\ScenarioFTest
Definition: ScenarioFTest.php:48
‪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\ScenarioFTest\setUp
‪setUp()
Definition: ScenarioFTest.php:49
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioFTest\resolvablePagesDataProvider
‪array resolvablePagesDataProvider()
Definition: ScenarioFTest.php:69
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\AbstractLocalizedPagesTestCase\setUpDatabaseWithYamlPayload
‪setUpDatabaseWithYamlPayload(string $pathToYamlFile)
Definition: AbstractLocalizedPagesTestCase.php:61
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioFTest\resolvedPagesMatchScopes
‪resolvedPagesMatchScopes(string $url, array $scopes)
Definition: ScenarioFTest.php:100
‪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\ScenarioFTest\pageMenuIsRendered
‪pageMenuIsRendered(string $url, array $expectedMenu)
Definition: ScenarioFTest.php:190
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioFTest\menuDataProvider
‪array menuDataProvider()
Definition: ScenarioFTest.php:153
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioFTest\requestsThrowException
‪requestsThrowException(string $url, string $exception)
Definition: ScenarioFTest.php:145