‪TYPO3CMS  9.5
ScenarioBTest.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 
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', 'EN']),
54  ]
55  );
56 
57  $this->‪setUpDatabaseWithYamlPayload(__DIR__ . '/Fixtures/ScenarioB.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-CH where page translation does not exist' => [
73  'url' => 'https://acme.com/de-ch/hello',
74  'scopes' => [
75  'page/title' => 'EN: Welcome',
76  ],
77  ],
78  'headquarter sub page in EN' => [
79  'url' => 'https://acme.com/en/about-us/headquarter',
80  'scopes' => [
81  'page/title' => 'EN: Headquarter',
82  ],
83  ],
84  'headquarter sub page in DE-CH where page translation does not exist' => [
85  'url' => 'https://acme.com/de-ch/about-us/headquarter',
86  'scopes' => [
87  'page/title' => 'EN: Headquarter',
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 where page translation does not exist and has no fallback configured' => [
112  'url' => 'https://acme.com/de/hello',
113  'exception' => PageNotFoundException::class,
114  ],
115  ];
116  }
117 
125  public function ‪requestsThrowException(string $url, string $exception): void
126  {
127  $this->‪assertException($url, $exception);
128  }
129 
133  public function ‪menuDataProvider(): array
134  {
135  return [
136  [
137  'url' => 'https://acme.com/en/hello',
138  'menu' => [
139  ['title' => 'EN: Welcome', 'link' => '/en/hello'],
140  ['title' => 'EN: About us', 'link' => '/en/about-us'],
141  ],
142  ],
143  [
144  'url' => 'https://acme.com/de-ch/hello',
145  'menu' => [
146  ['title' => 'EN: Welcome', 'link' => '/de-ch/hello'],
147  ['title' => 'DE-CH: Über uns', 'link' => '/de-ch/about-us'],
148  ],
149  ],
150  ];
151  }
152 
160  public function ‪pageMenuIsRendered(string $url, array $expectedMenu): void
161  {
162  $this->‪assertMenu($url, $expectedMenu);
163  }
164 }
‪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\ScenarioBTest\pageNotFoundDataProvider
‪array pageNotFoundDataProvider()
Definition: ScenarioBTest.php:108
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioBTest\resolvablePagesDataProvider
‪array resolvablePagesDataProvider()
Definition: ScenarioBTest.php:63
‪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\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioBTest\menuDataProvider
‪array menuDataProvider()
Definition: ScenarioBTest.php:133
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioBTest\resolvedPagesMatchScopes
‪resolvedPagesMatchScopes(string $url, array $scopes)
Definition: ScenarioBTest.php:100
‪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\ScenarioBTest\pageMenuIsRendered
‪pageMenuIsRendered(string $url, array $expectedMenu)
Definition: ScenarioBTest.php:160
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\AbstractLocalizedPagesTestCase
Definition: AbstractLocalizedPagesTestCase.php:25
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioBTest\setUp
‪setUp()
Definition: ScenarioBTest.php:43
‪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\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\ScenarioBTest
Definition: ScenarioBTest.php:42
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\LocalizedPageRendering\ScenarioBTest\requestsThrowException
‪requestsThrowException(string $url, string $exception)
Definition: ScenarioBTest.php:125