‪TYPO3CMS  11.5
MultiSiteTest.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 
23 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
24 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\ResponseContent;
25 
30 {
31  protected const ‪VALUE_PageIdWebsite = 1;
32  protected const ‪VALUE_PageIdSecondSite = 50;
33 
34  protected const ‪TABLE_Page = 'pages';
35 
36  protected function ‪setUp(): void
37  {
38  parent::setUp();
39 
40  $this->importCSVDataSet(__DIR__ . '/../DataSet/ImportDefault.csv');
41 
42  $this->setUpFrontendRootPage(1, ['typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.typoscript']);
43  $this->‪setUpFrontendSite(1, $this->siteLanguageConfiguration);
44  }
45 
50  public function ‪moveRootPageToDifferentPageTree(): void
51  {
52  // Warm up caches for the root line utility to identify side effects
53  GeneralUtility::makeInstance(SiteMatcher::class)->matchByPageId(self::VALUE_PageIdWebsite);
54  GeneralUtility::makeInstance(SiteMatcher::class)->matchByPageId(self::VALUE_PageIdSecondSite);
55 
56  // URL is now "/1" for the second site
57  $this->actionService->moveRecord(self::TABLE_Page, self::VALUE_PageIdSecondSite, self::VALUE_PageIdWebsite);
58  $this->assertCSVDataSet(__DIR__ . '/DataSet/moveRootPageToDifferentPageTree.csv');
59 
60  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::VALUE_PageIdSecondSite));
61  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
62  self::assertThat($responseSections, $this->‪getRequestSectionHasRecordConstraint()
63  ->setTable(self::TABLE_Page)->setField('title')->setValues('Second Root Page'));
64  }
65 }
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\setUpFrontendSite
‪setUpFrontendSite(int $pageId, array $additionalLanguages=[])
Definition: AbstractDataHandlerActionTestCase.php:127
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\getRequestSectionHasRecordConstraint
‪HasRecordConstraint getRequestSectionHasRecordConstraint()
Definition: AbstractDataHandlerActionTestCase.php:245
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\MultiSite\MultiSiteTest\VALUE_PageIdSecondSite
‪const VALUE_PageIdSecondSite
Definition: MultiSiteTest.php:32
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\MultiSite\MultiSiteTest\setUp
‪setUp()
Definition: MultiSiteTest.php:36
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\MultiSite\MultiSiteTest\VALUE_PageIdWebsite
‪const VALUE_PageIdWebsite
Definition: MultiSiteTest.php:31
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase
Definition: AbstractDataHandlerActionTestCase.php:41
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\MultiSite\MultiSiteTest\TABLE_Page
‪const TABLE_Page
Definition: MultiSiteTest.php:34
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\MultiSite
Definition: MultiSiteTest.php:18
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\MultiSite\MultiSiteTest
Definition: MultiSiteTest.php:30
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:50
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\MultiSite\MultiSiteTest\moveRootPageToDifferentPageTree
‪moveRootPageToDifferentPageTree()
Definition: MultiSiteTest.php:50
‪TYPO3\CMS\Core\Routing\SiteMatcher
Definition: SiteMatcher.php:52