‪TYPO3CMS  9.5
BackendUserAuthenticationTest.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 
21 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
22 
26 class ‪BackendUserAuthenticationTest extends FunctionalTestCase
27 {
33  protected ‪$backendUserFixture = __DIR__ . '/Fixtures/be_users.xml';
34 
38  protected ‪$authenticationService;
39 
43  protected ‪$subject;
44 
49  protected function ‪setUp(): void
50  {
51  ‪$GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts'] = 1;
52  ‪$GLOBALS['TYPO3_CONF_VARS']['BE']['cookieName'] = 'be_typo_user';
53  ‪$GLOBALS['TYPO3_CONF_VARS']['BE']['warning_email_addr'] = '';
54  ‪$GLOBALS['TYPO3_CONF_VARS']['BE']['lockIP'] = 4;
55  ‪$GLOBALS['TYPO3_CONF_VARS']['BE']['sessionTimeout'] = 28800;
56 
57  $this->subject = new ‪BackendUserAuthentication();
58  parent::setUp();
59  $this->importDataSet(__DIR__ . '/Fixtures/be_groups.xml');
60  $this->importDataSet(__DIR__ . '/Fixtures/pages.xml');
61  $this->setUpBackendUserFromFixture(2);
63  $this->subject = ‪$GLOBALS['BE_USER'];
64  }
65 
70  {
71  $result = $this->subject->isInWebMount(2);
72  $this->assertNotNull($result);
73  }
74 
78  public function ‪returnWebmountsFilterOutInaccessiblePages(): void
79  {
80  $result = $this->subject->returnWebmounts();
81 
82  self::assertNotContains('3', $result, 'Deleted page is not filtered out');
83  self::assertNotContains('4', $result, 'Page user has no permission to read is not filtered out');
84  self::assertNotContains('5', $result, 'Not existing page is not filtered out');
85  self::assertContains('40', $result, 'Accessible db mount page, child of a not accessible page is not shown');
86  self::assertEquals(['1', '40'], $result);
87  }
88 }
‪TYPO3\CMS\Core\Tests\Functional\Authentication\BackendUserAuthenticationTest\$subject
‪BackendUserAuthentication $subject
Definition: BackendUserAuthenticationTest.php:40
‪TYPO3\CMS\Core\Tests\Functional\Authentication\BackendUserAuthenticationTest\$backendUserFixture
‪string $backendUserFixture
Definition: BackendUserAuthenticationTest.php:32
‪TYPO3\CMS\Core\Tests\Functional\Authentication\BackendUserAuthenticationTest\$authenticationService
‪AuthenticationService $authenticationService
Definition: BackendUserAuthenticationTest.php:36
‪TYPO3\CMS\Core\Tests\Functional\Authentication\BackendUserAuthenticationTest
Definition: BackendUserAuthenticationTest.php:27
‪TYPO3\CMS\Core\Tests\Functional\Authentication
Definition: AbstractUserAuthenticationTest.php:3
‪TYPO3\CMS\Core\Tests\Functional\Authentication\BackendUserAuthenticationTest\setUp
‪setUp()
Definition: BackendUserAuthenticationTest.php:46
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:45
‪TYPO3\CMS\Core\Tests\Functional\Authentication\BackendUserAuthenticationTest\getTranslatedPageOnWebMountIsInWebMountForNonAdminUser
‪getTranslatedPageOnWebMountIsInWebMountForNonAdminUser()
Definition: BackendUserAuthenticationTest.php:66
‪TYPO3\CMS\Core\Authentication\AuthenticationService
Definition: AuthenticationService.php:30
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Tests\Functional\Authentication\BackendUserAuthenticationTest\returnWebmountsFilterOutInaccessiblePages
‪returnWebmountsFilterOutInaccessiblePages()
Definition: BackendUserAuthenticationTest.php:75