‪TYPO3CMS  11.5
SelectCheckBoxTest.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 TYPO3\CMS\Backend\Utility\BackendUtility;
23 use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\ActionService;
24 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
25 
26 class ‪SelectCheckBoxTest extends FunctionalTestCase
27 {
28  protected const ‪PAGE_ID = 0;
30 
31  protected function ‪setUp(): void
32  {
33  parent::setUp();
34  $this->importCSVDataSet(__DIR__ . '/../../Fixtures/be_users.csv');
35  $this->backendUserAuthentication = $this->setUpBackendUser(1);
37  }
38 
42  public function ‪validMultipleChecked(): void
43  {
44  $newUserRecord = $this->‪createBackendUser([
45  'file_permissions' => 'readFolder,writeFolder,renameFolder,moveFolder,writeFile,addFile,moveFile,copyFile',
46  ]);
47  self::assertEquals(
48  'readFolder,writeFolder,renameFolder,moveFolder,writeFile,addFile,moveFile,copyFile',
49  $newUserRecord['file_permissions']
50  );
51  }
52 
56  public function ‪validNoneCheckedEmptyValuesAllowed(): void
57  {
58  $newUserRecord = $this->‪createBackendUser(['file_permissions' => '']);
59  self::assertEquals('', $newUserRecord['file_permissions']);
60  }
61 
62  protected function ‪createBackendUser(array $backendUser): array
63  {
64  $actionService = new ActionService();
65  $map = $actionService->createNewRecord('be_users', self::PAGE_ID, $backendUser);
66  $newUserId = reset($map['be_users']);
67  return BackendUtility::getRecord('be_users', $newUserId);
68  }
69 }
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler\SelectCheckBoxTest\setUp
‪setUp()
Definition: SelectCheckBoxTest.php:31
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler\SelectCheckBoxTest\PAGE_ID
‪const PAGE_ID
Definition: SelectCheckBoxTest.php:28
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler
Definition: DefaultValuesTest.php:18
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler\SelectCheckBoxTest\createBackendUser
‪createBackendUser(array $backendUser)
Definition: SelectCheckBoxTest.php:62
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler\SelectCheckBoxTest\validNoneCheckedEmptyValuesAllowed
‪validNoneCheckedEmptyValuesAllowed()
Definition: SelectCheckBoxTest.php:56
‪TYPO3\CMS\Core\Core\Bootstrap\initializeLanguageObject
‪static initializeLanguageObject()
Definition: Bootstrap.php:598
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler\SelectCheckBoxTest\validMultipleChecked
‪validMultipleChecked()
Definition: SelectCheckBoxTest.php:42
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:62
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler\SelectCheckBoxTest
Definition: SelectCheckBoxTest.php:27
‪TYPO3\CMS\Core\Core\Bootstrap
Definition: Bootstrap.php:70
‪TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler\SelectCheckBoxTest\$backendUserAuthentication
‪BackendUserAuthentication $backendUserAuthentication
Definition: SelectCheckBoxTest.php:29