‪TYPO3CMS  ‪main
ContentObjectRendererGetDataPageLayoutTest.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 
20 use PHPUnit\Framework\Attributes\Test;
22 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
23 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
24 
28 final class ‪ContentObjectRendererGetDataPageLayoutTest extends FunctionalTestCase
29 {
31 
32  protected const ‪LANGUAGE_PRESETS = [
33  'EN' => ['id' => 0, 'title' => 'English', 'locale' => 'en_US.UTF8'],
34  ];
35  private const ‪ROOT_PAGE_ID = 1;
36 
37  public function ‪setUp(): void
38  {
39  parent::setUp();
41  'tree_page_layout_test',
42  $this->‪buildSiteConfiguration(self::ROOT_PAGE_ID, '/'),
43  );
44  }
45 
46  #[Test]
48  {
49  $this->importCSVDataSet(__DIR__ . '/Fixtures/ContentObjectRendererGetDataPageLayout/backendLayoutOnRootPage.csv');
50  $this->setUpFrontendRootPage(
51  self::ROOT_PAGE_ID,
52  [
53  'EXT:frontend/Tests/Functional/ContentObject/Fixtures/ContentObjectRendererGetDataPageLayout/setup.typoscript',
54  ]
55  );
56  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::ROOT_PAGE_ID));
57  self::assertStringContainsString('pagets__default', (string)$response->getBody());
58  }
59 
60  #[Test]
62  {
63  $this->importCSVDataSet(__DIR__ . '/Fixtures/ContentObjectRendererGetDataPageLayout/backendLayoutNextLevelOnRootPage.csv');
64  $this->setUpFrontendRootPage(
65  self::ROOT_PAGE_ID,
66  [
67  'EXT:frontend/Tests/Functional/ContentObject/Fixtures/ContentObjectRendererGetDataPageLayout/setup.typoscript',
68  ]
69  );
70  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::ROOT_PAGE_ID));
71  self::assertStringNotContainsString('pagets__default', (string)$response->getBody());
72  }
73 
74  #[Test]
76  {
77  $this->importCSVDataSet(__DIR__ . '/Fixtures/ContentObjectRendererGetDataPageLayout/backendLayoutAndNextLevelOnRootPage.csv');
78  $this->setUpFrontendRootPage(
79  self::ROOT_PAGE_ID,
80  [
81  'EXT:frontend/Tests/Functional/ContentObject/Fixtures/ContentObjectRendererGetDataPageLayout/setup.typoscript',
82  ]
83  );
84  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(2));
85  self::assertStringContainsString('pagets__inherit', (string)$response->getBody());
86  }
87 
88  #[Test]
90  {
91  $this->importCSVDataSet(__DIR__ . '/Fixtures/ContentObjectRendererGetDataPageLayout/backendLayoutAndNextLevelOnRootPageSubOverride1.csv');
92  $this->setUpFrontendRootPage(
93  self::ROOT_PAGE_ID,
94  [
95  'EXT:frontend/Tests/Functional/ContentObject/Fixtures/ContentObjectRendererGetDataPageLayout/setup.typoscript',
96  ]
97  );
98  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(3));
99  self::assertStringContainsString('pagets__inherit', (string)$response->getBody());
100  }
101 
102  #[Test]
104  {
105  $this->importCSVDataSet(__DIR__ . '/Fixtures/ContentObjectRendererGetDataPageLayout/backendLayoutAndNextLevelOnRootPageSubOverride2.csv');
106  $this->setUpFrontendRootPage(
107  self::ROOT_PAGE_ID,
108  [
109  'EXT:frontend/Tests/Functional/ContentObject/Fixtures/ContentObjectRendererGetDataPageLayout/setup.typoscript',
110  ]
111  );
112  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(4));
113  self::assertStringContainsString('pagets__bar', (string)$response->getBody());
114  }
115 
116  #[Test]
118  {
119  $this->importCSVDataSet(__DIR__ . '/Fixtures/ContentObjectRendererGetDataPageLayout/backendLayoutAndNextLevelOnRootPageSubOverride3.csv');
120  $this->setUpFrontendRootPage(
121  self::ROOT_PAGE_ID,
122  [
123  'EXT:frontend/Tests/Functional/ContentObject/Fixtures/ContentObjectRendererGetDataPageLayout/setup.typoscript',
124  ]
125  );
126  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(4));
127  self::assertStringContainsString('pagets__extra', (string)$response->getBody());
128  }
129 }
‪TYPO3\CMS\Frontend\Tests\Functional\ContentObject\ContentObjectRendererGetDataPageLayoutTest\pageLayoutResolvedForBackendLayoutNextLevelOverrideOnSubpageLevel3
‪pageLayoutResolvedForBackendLayoutNextLevelOverrideOnSubpageLevel3()
Definition: ContentObjectRendererGetDataPageLayoutTest.php:116
‪TYPO3\CMS\Frontend\Tests\Functional\ContentObject\ContentObjectRendererGetDataPageLayoutTest\pageLayoutResolvedForBackendLayoutNextLevelInheritedOnSubpageLevel2
‪pageLayoutResolvedForBackendLayoutNextLevelInheritedOnSubpageLevel2()
Definition: ContentObjectRendererGetDataPageLayoutTest.php:88
‪TYPO3\CMS\Frontend\Tests\Functional\ContentObject\ContentObjectRendererGetDataPageLayoutTest\pageLayoutNotResolvedForBackendLayoutNextLevelOnRootPage
‪pageLayoutNotResolvedForBackendLayoutNextLevelOnRootPage()
Definition: ContentObjectRendererGetDataPageLayoutTest.php:60
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait
Definition: SiteBasedTestTrait.php:37
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\writeSiteConfiguration
‪writeSiteConfiguration(string $identifier, array $site=[], array $languages=[], array $errorHandling=[])
Definition: SiteBasedTestTrait.php:50
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildSiteConfiguration
‪buildSiteConfiguration(int $rootPageId, string $base='')
Definition: SiteBasedTestTrait.php:88
‪TYPO3\CMS\Frontend\Tests\Functional\ContentObject\ContentObjectRendererGetDataPageLayoutTest\pageLayoutResolvedForBackendLayoutOnRootPage
‪pageLayoutResolvedForBackendLayoutOnRootPage()
Definition: ContentObjectRendererGetDataPageLayoutTest.php:46
‪TYPO3\CMS\Frontend\Tests\Functional\ContentObject\ContentObjectRendererGetDataPageLayoutTest\pageLayoutResolvedForBackendLayoutNextLevelInheritedOnSubpageLevel1
‪pageLayoutResolvedForBackendLayoutNextLevelInheritedOnSubpageLevel1()
Definition: ContentObjectRendererGetDataPageLayoutTest.php:74
‪TYPO3\CMS\Frontend\Tests\Functional\ContentObject\ContentObjectRendererGetDataPageLayoutTest\setUp
‪setUp()
Definition: ContentObjectRendererGetDataPageLayoutTest.php:36
‪TYPO3\CMS\Frontend\Tests\Functional\ContentObject\ContentObjectRendererGetDataPageLayoutTest\ROOT_PAGE_ID
‪const ROOT_PAGE_ID
Definition: ContentObjectRendererGetDataPageLayoutTest.php:34
‪TYPO3\CMS\Frontend\Tests\Functional\ContentObject\ContentObjectRendererGetDataPageLayoutTest\pageLayoutResolvedForBackendLayoutOnSubpageLevel3
‪pageLayoutResolvedForBackendLayoutOnSubpageLevel3()
Definition: ContentObjectRendererGetDataPageLayoutTest.php:102
‪TYPO3\CMS\Frontend\Tests\Functional\ContentObject
Definition: ContentContentObjectTest.php:18
‪TYPO3\CMS\Frontend\Tests\Functional\ContentObject\ContentObjectRendererGetDataPageLayoutTest
Definition: ContentObjectRendererGetDataPageLayoutTest.php:29
‪TYPO3\CMS\Frontend\Tests\Functional\ContentObject\ContentObjectRendererGetDataPageLayoutTest\LANGUAGE_PRESETS
‪const LANGUAGE_PRESETS
Definition: ContentObjectRendererGetDataPageLayoutTest.php:31