‪TYPO3CMS  9.5
ScenarioCTest.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 
43 {
44  protected function ‪setUp(): void
45  {
46  parent::setUp();
47 
49  'acme-com',
50  $this->‪buildSiteConfiguration(1000, 'https://acme.com/'),
51  [
52  $this->‪buildDefaultLanguageConfiguration('EN', 'https://acme.com/en'),
53  $this->‪buildLanguageConfiguration('DE', 'https://acme.com/de'),
54  $this->‪buildLanguageConfiguration('DE-CH', 'https://acme.com/de-ch', ['DE']),
55  ]
56  );
57 
58  $this->‪setUpDatabaseWithYamlPayload(__DIR__ . '/Fixtures/ScenarioC.yaml');
59  }
60 
64  public function ‪resolvablePagesDataProvider(): array
65  {
66  return [
67  'home page in EN' => [
68  'url' => 'https://acme.com/en/hello',
69  'scopes' => [
70  'page/title' => 'EN: Welcome',
71  ],
72  ],
73  'home page in DE' => [
74  'url' => 'https://acme.com/de/willkommen',
75  'scopes' => [
76  'page/title' => 'DE: Willkommen',
77  ],
78  ],
79  'about page in EN' => [
80  'url' => 'https://acme.com/en/about-us',
81  'scopes' => [
82  'page/title' => 'EN: About us',
83  ],
84  ],
85  'about page in DE-CH' => [
86  'url' => 'https://acme.com/de-ch/ueber-uns',
87  'scopes' => [
88  'page/title' => 'DE-CH: Über uns',
89  ],
90  ],
91  ];
92  }
93 
101  public function ‪resolvedPagesMatchScopes(string $url, array $scopes): void
102  {
103  $this->‪assertScopes($url, $scopes);
104  }
105 
109  public function ‪pageNotFoundDataProvider(): array
110  {
111  return [
112  'home page in DE-CH where page translation does not exist and is trapped by l18n_cfg' => [
113  'url' => 'https://acme.com/de-ch/wllkommen',
114  'exception' => PageNotFoundException::class,
115  ],
116  'about page in DE where page translation does not exist and is trapped by l18n_cfg' => [
117  'url' => 'https://acme.com/de/ueber-uns',
118  'exception' => PageNotFoundException::class,
119  ],
120  ];
121  }
122 
130  public function ‪requestsThrowException(string $url, string $exception): void
131  {
132  $this->‪assertException($url, $exception);
133  }
134 
138  public function ‪menuDataProvider(): array
139  {
140  return [
141  [
142  'url' => 'https://acme.com/en/hello',
143  'menu' => [
144  ['title' => 'EN: Welcome', 'link' => '/en/hello'],
145  ['title' => 'EN: About us', 'link' => '/en/about-us'],
146  ],
147  ],
148  [
149  'url' => 'https://acme.com/de/willkommen',
150  'menu' => [
151  ['title' => 'DE: Willkommen', 'link' => '/de/willkommen'],
152  ],
153  ],
154  [
155  'url' => 'https://acme.com/en/about-us',
156  'menu' => [
157  ['title' => 'EN: Welcome', 'link' => '/en/hello'],
158  ['title' => 'EN: About us', 'link' => '/en/about-us'],
159  ],
160  ],
161  [
162  'url' => 'https://acme.com/de-ch/ueber-uns',
163  'menu' => [
164  ['title' => 'DE-CH: Über uns', 'link' => '/de-ch/ueber-uns'],
165  ],
166  ],
167  ];
168  }
169 
177  public function ‪pageMenuIsRendered(string $url, array $expectedMenu): void
178  {
179  $this->‪assertMenu($url, $expectedMenu);
180  }
181 }
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioCTest\resolvedPagesMatchScopes
‪resolvedPagesMatchScopes(string $url, array $scopes)
Definition: ScenarioCTest.php:101
‪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\ScenarioCTest\requestsThrowException
‪requestsThrowException(string $url, string $exception)
Definition: ScenarioCTest.php:130
‪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\ScenarioCTest
Definition: ScenarioCTest.php:43
‪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\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildDefaultLanguageConfiguration
‪array buildDefaultLanguageConfiguration(string $identifier, string $base)
Definition: SiteBasedTestTrait.php:122
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioCTest\pageNotFoundDataProvider
‪array pageNotFoundDataProvider()
Definition: ScenarioCTest.php:109
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioCTest\setUp
‪setUp()
Definition: ScenarioCTest.php:44
‪TYPO3\CMS\Core\Error\Http\PageNotFoundException
Definition: PageNotFoundException.php:21
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioCTest\resolvablePagesDataProvider
‪array resolvablePagesDataProvider()
Definition: ScenarioCTest.php:64
‪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\ScenarioCTest\menuDataProvider
‪array menuDataProvider()
Definition: ScenarioCTest.php:138
‪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\ScenarioCTest\pageMenuIsRendered
‪pageMenuIsRendered(string $url, array $expectedMenu)
Definition: ScenarioCTest.php:177