‪TYPO3CMS  10.4
ScenarioCTest.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 
42 {
43  protected function ‪setUp(): void
44  {
45  parent::setUp();
46 
48  'acme-com',
49  $this->‪buildSiteConfiguration(1000, 'https://acme.com/'),
50  [
51  $this->‪buildDefaultLanguageConfiguration('EN', 'https://acme.com/en'),
52  $this->‪buildLanguageConfiguration('DE', 'https://acme.com/de'),
53  $this->‪buildLanguageConfiguration('DE-CH', 'https://acme.com/de-ch', ['DE']),
54  ]
55  );
56 
57  $this->‪setUpDatabaseWithYamlPayload(__DIR__ . '/Fixtures/ScenarioC.yaml');
58  }
59 
63  public function ‪resolvablePagesDataProvider(): array
64  {
65  return [
66  'home page in EN' => [
67  'url' => 'https://acme.com/en/hello',
68  'scopes' => [
69  'page/title' => 'EN: Welcome',
70  ],
71  ],
72  'home page in DE' => [
73  'url' => 'https://acme.com/de/willkommen',
74  'scopes' => [
75  'page/title' => 'DE: Willkommen',
76  ],
77  ],
78  'about page in EN' => [
79  'url' => 'https://acme.com/en/about-us',
80  'scopes' => [
81  'page/title' => 'EN: About us',
82  ],
83  ],
84  'about page in DE-CH' => [
85  'url' => 'https://acme.com/de-ch/ueber-uns',
86  'scopes' => [
87  'page/title' => 'DE-CH: Über uns',
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 DE-CH where page translation does not exist and is trapped by l18n_cfg' => [
112  'url' => 'https://acme.com/de-ch/wllkommen',
113  ],
114  'about page in DE where page translation does not exist and is trapped by l18n_cfg' => [
115  'url' => 'https://acme.com/de/ueber-uns',
116  ],
117  ];
118  }
119 
126  public function ‪pageNotFound(string $url): void
127  {
128  $this->‪assertResponseStatusCode($url, 404);
129  }
130 
134  public function ‪menuDataProvider(): array
135  {
136  return [
137  [
138  'url' => 'https://acme.com/en/hello',
139  'menu' => [
140  ['title' => 'EN: Welcome', 'link' => '/en/hello'],
141  ['title' => 'EN: About us', 'link' => '/en/about-us'],
142  ],
143  ],
144  [
145  'url' => 'https://acme.com/de/willkommen',
146  'menu' => [
147  ['title' => 'DE: Willkommen', 'link' => '/de/willkommen'],
148  ],
149  ],
150  [
151  'url' => 'https://acme.com/en/about-us',
152  'menu' => [
153  ['title' => 'EN: Welcome', 'link' => '/en/hello'],
154  ['title' => 'EN: About us', 'link' => '/en/about-us'],
155  ],
156  ],
157  [
158  'url' => 'https://acme.com/de-ch/ueber-uns',
159  'menu' => [
160  ['title' => 'DE-CH: Über uns', 'link' => '/de-ch/ueber-uns'],
161  ],
162  ],
163  ];
164  }
165 
173  public function ‪pageMenuIsRendered(string $url, array $expectedMenu): void
174  {
175  $this->‪assertMenu($url, $expectedMenu);
176  }
177 }
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioCTest\resolvedPagesMatchScopes
‪resolvedPagesMatchScopes(string $url, array $scopes)
Definition: ScenarioCTest.php:100
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\AbstractLocalizedPagesTestCase\assertScopes
‪assertScopes(string $url, array $scopes)
Definition: AbstractLocalizedPagesTestCase.php:90
‪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\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioCTest
Definition: ScenarioCTest.php:42
‪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\ScenarioCTest\pageNotFoundDataProvider
‪array pageNotFoundDataProvider()
Definition: ScenarioCTest.php:108
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioCTest\setUp
‪setUp()
Definition: ScenarioCTest.php:43
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioCTest\resolvablePagesDataProvider
‪array resolvablePagesDataProvider()
Definition: ScenarioCTest.php:63
‪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\ScenarioCTest\pageNotFound
‪pageNotFound(string $url)
Definition: ScenarioCTest.php:126
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioCTest\menuDataProvider
‪array menuDataProvider()
Definition: ScenarioCTest.php:134
‪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\ScenarioCTest\pageMenuIsRendered
‪pageMenuIsRendered(string $url, array $expectedMenu)
Definition: ScenarioCTest.php:173