‪TYPO3CMS  10.4
ScenarioBTest.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 
41 {
42  protected function ‪setUp(): void
43  {
44  parent::setUp();
45 
47  'acme-com',
48  $this->‪buildSiteConfiguration(1000, 'https://acme.com/'),
49  [
50  $this->‪buildDefaultLanguageConfiguration('EN', 'https://acme.com/en'),
51  $this->‪buildLanguageConfiguration('DE', 'https://acme.com/de'),
52  $this->‪buildLanguageConfiguration('DE-CH', 'https://acme.com/de-ch', ['DE', 'EN']),
53  ]
54  );
55 
56  $this->‪setUpDatabaseWithYamlPayload(__DIR__ . '/Fixtures/ScenarioB.yaml');
57  }
58 
62  public function ‪resolvablePagesDataProvider(): array
63  {
64  return [
65  'home page in EN' => [
66  'url' => 'https://acme.com/en/hello',
67  'scopes' => [
68  'page/title' => 'EN: Welcome',
69  ],
70  ],
71  'home page in DE-CH where page translation does not exist' => [
72  'url' => 'https://acme.com/de-ch/hello',
73  'scopes' => [
74  'page/title' => 'EN: Welcome',
75  ],
76  ],
77  'headquarter sub page in EN' => [
78  'url' => 'https://acme.com/en/about-us/headquarter',
79  'scopes' => [
80  'page/title' => 'EN: Headquarter',
81  ],
82  ],
83  'headquarter sub page in DE-CH where page translation does not exist' => [
84  'url' => 'https://acme.com/de-ch/about-us/headquarter',
85  'scopes' => [
86  'page/title' => 'EN: Headquarter',
87  ],
88  ],
89  ];
90  }
91 
99  public function ‪resolvedPagesMatchScopes(string $url, array $scopes): void
100  {
101  $this->‪assertScopes($url, $scopes);
102  }
103 
107  public function ‪pageNotFoundDataProvider(): array
108  {
109  return [
110  'home page in DE where page translation does not exist and has no fallback configured' => [
111  'url' => 'https://acme.com/de/hello',
112  ],
113  ];
114  }
115 
122  public function ‪pageNotFound(string $url): void
123  {
124  $this->‪assertResponseStatusCode($url, 404);
125  }
126 
130  public function ‪menuDataProvider(): array
131  {
132  return [
133  [
134  'url' => 'https://acme.com/en/hello',
135  'menu' => [
136  ['title' => 'EN: Welcome', 'link' => '/en/hello'],
137  ['title' => 'EN: About us', 'link' => '/en/about-us'],
138  ],
139  ],
140  [
141  'url' => 'https://acme.com/de-ch/hello',
142  'menu' => [
143  ['title' => 'EN: Welcome', 'link' => '/de-ch/hello'],
144  ['title' => 'DE-CH: Über uns', 'link' => '/de-ch/about-us'],
145  ],
146  ],
147  ];
148  }
149 
157  public function ‪pageMenuIsRendered(string $url, array $expectedMenu): void
158  {
159  $this->‪assertMenu($url, $expectedMenu);
160  }
161 }
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\AbstractLocalizedPagesTestCase\assertScopes
‪assertScopes(string $url, array $scopes)
Definition: AbstractLocalizedPagesTestCase.php:90
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioBTest\pageNotFoundDataProvider
‪array pageNotFoundDataProvider()
Definition: ScenarioBTest.php:107
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioBTest\resolvablePagesDataProvider
‪array resolvablePagesDataProvider()
Definition: ScenarioBTest.php:62
‪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\ScenarioBTest\menuDataProvider
‪array menuDataProvider()
Definition: ScenarioBTest.php:130
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioBTest\resolvedPagesMatchScopes
‪resolvedPagesMatchScopes(string $url, array $scopes)
Definition: ScenarioBTest.php:99
‪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\ScenarioBTest\pageMenuIsRendered
‪pageMenuIsRendered(string $url, array $expectedMenu)
Definition: ScenarioBTest.php:157
‪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\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioBTest\setUp
‪setUp()
Definition: ScenarioBTest.php:42
‪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\AbstractLocalizedPagesTestCase\assertMenu
‪assertMenu(string $url, array $expectation)
Definition: AbstractLocalizedPagesTestCase.php:128
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\AbstractLocalizedPagesTestCase\setUpDatabaseWithYamlPayload
‪setUpDatabaseWithYamlPayload(string $pathToYamlFile)
Definition: AbstractLocalizedPagesTestCase.php:65
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioBTest\pageNotFound
‪pageNotFound(string $url)
Definition: ScenarioBTest.php:122
‪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\ScenarioBTest
Definition: ScenarioBTest.php:41