-
Notifications
You must be signed in to change notification settings - Fork 653
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
To determine the opened page branch, the uc path must be BackendComponents.States.Pagetree.stateHash instead of browseTrees.browsePages. The configuration must also contain the following structure [ 1_1234 => 1, 1_3456 => 1 ] instead of [ 1 => [ 1234, 3456 ] ] Otherwise the page won't be expanded properly. Resolves: #90985 Releases: master, 10.4 Change-Id: I63fb967c3d47286f24e4e469c4947a3c09047605 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64109 Tested-by: core-ci <typo3@b13.com> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Benni Mack <benni@typo3.org> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Benni Mack <benni@typo3.org>
- Loading branch information
Showing
2 changed files
with
71 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
typo3/sysext/backend/Tests/Functional/Utility/BackendUtilityTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace TYPO3\CMS\Backend\Tests\Functional\Utility; | ||
|
||
use TYPO3\CMS\Backend\Utility\BackendUtility; | ||
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; | ||
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; | ||
|
||
class BackendUtilityTest extends FunctionalTestCase | ||
{ | ||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
$this->importDataSet('PACKAGE:typo3/testing-framework/Resources/Core/Functional/Fixtures/pages.xml'); | ||
$this->setUpBackendUserFromFixture(1); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function givenPageIdCanBeExpanded(): void | ||
{ | ||
$backendUser = $this->getBackendUser(); | ||
$backendUser->groupData['webmounts'] = '1'; | ||
|
||
BackendUtility::openPageTree(5, false); | ||
|
||
$expectedSiteHash = [ | ||
'1_5' => '1', | ||
'1_1' => '1', | ||
'1_0' => '1' | ||
]; | ||
$actualSiteHash = $backendUser->uc['BackendComponents']['States']['Pagetree']['stateHash']; | ||
self::assertSame($expectedSiteHash, $actualSiteHash); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function otherBranchesCanBeClosedWhenOpeningPage(): void | ||
{ | ||
$backendUser = $this->getBackendUser(); | ||
$backendUser->groupData['webmounts'] = '1'; | ||
|
||
BackendUtility::openPageTree(5, false); | ||
BackendUtility::openPageTree(4, true); | ||
|
||
//the complete branch of uid => 5 should be closed here | ||
$expectedSiteHash = [ | ||
'1_4' => '1', | ||
'1_3' => '1', | ||
'1_2' => '1', | ||
'1_1' => '1', | ||
'1_0' => '1' | ||
]; | ||
$actualSiteHash = $backendUser->uc['BackendComponents']['States']['Pagetree']['stateHash']; | ||
self::assertSame($expectedSiteHash, $actualSiteHash); | ||
} | ||
|
||
private function getBackendUser(): BackendUserAuthentication | ||
{ | ||
return $GLOBALS['BE_USER']; | ||
} | ||
} |