‪TYPO3CMS  10.4
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 {
33 
34  const ‪TABLE_Page = 'pages';
35 
39  protected ‪$assertionDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/Regular/MultiSite/DataSet/';
40 
44  protected ‪$scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/Regular/DataSet/';
45 
46  protected function ‪setUp(): void
47  {
48  parent::setUp();
49 
50  $this->‪importScenarioDataSet('LiveDefaultMultiSitePages');
51  $this->‪importScenarioDataSet('LiveDefaultElements');
52 
53  $this->setUpFrontendRootPage(1, ['typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.typoscript']);
54  $this->‪setUpFrontendSite(1, $this->siteLanguageConfiguration);
55  }
56 
61  public function ‪moveRootPageToDifferentPageTree()
62  {
63  // Warm up caches for the root line utility to identify side effects
64  GeneralUtility::makeInstance(SiteMatcher::class)->matchByPageId(self::VALUE_PageIdWebsite);
65  GeneralUtility::makeInstance(SiteMatcher::class)->matchByPageId(self::VALUE_PageIdSecondSite);
66 
67  // URL is now "/1" for the second site
68  $this->actionService->moveRecord(self::TABLE_Page, self::VALUE_PageIdSecondSite, self::VALUE_PageIdWebsite);
69  $this->‪assertAssertionDataSet('moveRootPageToDifferentPageTree');
70 
71  $response = $this->executeFrontendRequest((new InternalRequest())->withPageId(self::VALUE_PageIdSecondSite));
72  $responseSections = ResponseContent::fromString((string)$response->getBody())->getSections();
73  self::assertThat($responseSections, $this->‪getRequestSectionHasRecordConstraint()
74  ->setTable(self::TABLE_Page)->setField('title')->setValues('Second Root Page'));
75  }
76 }
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\setUpFrontendSite
‪setUpFrontendSite(int $pageId, array $additionalLanguages=[])
Definition: AbstractDataHandlerActionTestCase.php:143
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\getRequestSectionHasRecordConstraint
‪HasRecordConstraint getRequestSectionHasRecordConstraint()
Definition: AbstractDataHandlerActionTestCase.php:289
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\MultiSiteTest\VALUE_PageIdSecondSite
‪const VALUE_PageIdSecondSite
Definition: MultiSiteTest.php:32
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\MultiSiteTest\moveRootPageToDifferentPageTree
‪moveRootPageToDifferentPageTree()
Definition: MultiSiteTest.php:59
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\MultiSiteTest\VALUE_PageIdWebsite
‪const VALUE_PageIdWebsite
Definition: MultiSiteTest.php:31
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\MultiSiteTest\TABLE_Page
‪const TABLE_Page
Definition: MultiSiteTest.php:34
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase
Definition: AbstractDataHandlerActionTestCase.php:37
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\MultiSiteTest
Definition: MultiSiteTest.php:30
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\MultiSiteTest\$assertionDataSetDirectory
‪string $assertionDataSetDirectory
Definition: MultiSiteTest.php:38
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\assertAssertionDataSet
‪assertAssertionDataSet($dataSetName)
Definition: AbstractDataHandlerActionTestCase.php:208
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular
Definition: AbstractActionTestCase.php:16
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\MultiSiteTest\setUp
‪setUp()
Definition: MultiSiteTest.php:44
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\MultiSiteTest\$scenarioDataSetDirectory
‪string $scenarioDataSetDirectory
Definition: MultiSiteTest.php:42
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Core\Routing\SiteMatcher
Definition: SiteMatcher.php:51
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\importScenarioDataSet
‪importScenarioDataSet($dataSetName)
Definition: AbstractDataHandlerActionTestCase.php:201