‪TYPO3CMS  10.4
BackendUserGroupTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
20 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
21 
25 class ‪BackendUserGroupTest extends UnitTestCase
26 {
30  protected ‪$subject;
31 
32  protected function ‪setUp(): void
33  {
34  parent::setUp();
35  $this->subject = new ‪BackendUserGroup();
36  }
37 
42  {
43  self::assertSame('', $this->subject->getTitle());
44  }
45 
49  public function ‪setTitleSetsTitle()
50  {
51  $title = 'foo bar';
52  $this->subject->setTitle($title);
53  self::assertSame($title, $this->subject->getTitle());
54  }
55 
60  {
61  self::assertSame('', $this->subject->getDescription());
62  }
63 
67  public function ‪setDescriptionSetsDescription()
68  {
69  $description = 'foo bar';
70  $this->subject->setDescription($description);
71  self::assertSame($description, $this->subject->getDescription());
72  }
73 
77  public function ‪setSubGroupsSetsSubgroups()
78  {
79  $subGroups = new ObjectStorage();
80  $this->subject->setSubGroups($subGroups);
81  self::assertSame($subGroups, $this->subject->getSubGroups());
82  }
83 
87  public function ‪anSubGroupCanBeRemoved()
88  {
89  $group1 = new BackendUserGroup();
90  $group1->setTitle('foo');
91  $group2 = new BackendUserGroup();
92  $group2->setTitle('bar');
93  $this->subject->addSubGroup($group1);
94  $this->subject->addSubGroup($group2);
95  self::assertEquals(count($this->subject->getSubGroups()), 2);
96  $this->subject->removeSubGroup($group1);
97  self::assertEquals(count($this->subject->getSubGroups()), 1);
98  $this->subject->removeSubGroup($group2);
99  self::assertEquals(count($this->subject->getSubGroups()), 0);
100  }
101 
105  public function ‪allSubGroupsCanBeRemoved()
106  {
107  $group1 = new BackendUserGroup();
108  $group1->setTitle('foo');
109  $group2 = new BackendUserGroup();
110  $group2->setTitle('bar');
111  $this->subject->addSubGroup($group1);
112  $this->subject->addSubGroup($group2);
113  $this->subject->removeAllSubGroups();
114  self::assertEquals(count($this->subject->getSubGroups()), 0);
115  }
116 
121  {
122  self::assertSame('', $this->subject->getModules());
123  }
124 
128  public function ‪setModulesSetsModules()
129  {
130  $modules = 'foo,bar';
131  $this->subject->setModules($modules);
132  self::assertSame($modules, $this->subject->getModules());
133  }
134 
139  {
140  self::assertSame('', $this->subject->getTablesListening());
141  }
142 
147  {
148  $tablesListening = 'foo,bar';
149  $this->subject->setTablesListening($tablesListening);
150  self::assertSame($tablesListening, $this->subject->getTablesListening());
151  }
152 
157  {
158  self::assertSame('', $this->subject->getTablesModify());
159  }
160 
165  {
166  self::assertSame('', $this->subject->getPageTypes());
167  }
168 
172  public function ‪setPageTypesSetsPageTypes()
173  {
174  $pageTypes = 'foo,bar';
175  $this->subject->setPageTypes($pageTypes);
176  self::assertSame($pageTypes, $this->subject->getPageTypes());
177  }
178 
182  public function ‪setTablesModifySetsTablesModify()
183  {
184  $tablesModify = 'foo,bar';
185  $this->subject->setTablesModify($tablesModify);
186  self::assertSame($tablesModify, $this->subject->getTablesModify());
187  }
188 
193  {
194  self::assertSame('', $this->subject->getAllowedExcludeFields());
195  }
196 
201  {
202  $allowedExcludeFields = 'foo,bar';
203  $this->subject->setAllowedExcludeFields($allowedExcludeFields);
204  self::assertSame($allowedExcludeFields, $this->subject->getAllowedExcludeFields());
205  }
206 
211  {
212  self::assertSame('', $this->subject->getExplicitlyAllowAndDeny());
213  }
214 
219  {
220  $explicitlyAllowAndDeny = 'foo,bar';
221  $this->subject->setExplicitlyAllowAndDeny($explicitlyAllowAndDeny);
222  self::assertSame($explicitlyAllowAndDeny, $this->subject->getExplicitlyAllowAndDeny());
223  }
224 
229  {
230  self::assertSame('', $this->subject->getAllowedLanguages());
231  }
232 
237  {
238  $allowedLanguages = '1,0';
239  $this->subject->setAllowedLanguages($allowedLanguages);
240  self::assertSame($allowedLanguages, $this->subject->getAllowedLanguages());
241  }
242 
247  {
248  self::assertFalse($this->subject->getWorkspacePermission());
249  }
250 
255  {
256  $this->subject->setWorkspacePermissions(true);
257  self::assertTrue($this->subject->getWorkspacePermission());
258  }
259 
264  {
265  self::assertSame('', $this->subject->getDatabaseMounts());
266  }
267 
272  {
273  $mounts = '1,42';
274  $this->subject->setDatabaseMounts($mounts);
275  self::assertSame($mounts, $this->subject->getDatabaseMounts());
276  }
277 
282  {
283  self::assertSame(0, $this->subject->getFileOperationPermissions());
284  }
285 
290  {
291  $permission = 7;
292  $this->subject->setFileOperationPermissions($permission);
293  self::assertSame($permission, $this->subject->getFileOperationPermissions());
294  }
295 
300  {
301  $this->subject->setFileOperationPermissions(0);
302  self::assertFalse($this->subject->isFileOperationAllowed());
303  $this->subject->setFileOperationPermissions(2);
304  self::assertFalse($this->subject->isFileOperationAllowed());
305  $this->subject->setFileOperationPermissions(6);
306  self::assertFalse($this->subject->isFileOperationAllowed());
307  }
308 
313  {
314  $this->subject->setFileOperationPermissions(1);
315  self::assertTrue($this->subject->isFileOperationAllowed());
316  $this->subject->setFileOperationPermissions(3);
317  self::assertTrue($this->subject->isFileOperationAllowed());
318  }
319 
324  {
325  $this->subject->setFileOperationPermissions(0);
326  $this->subject->setFileOperationAllowed(true);
327  self::assertTrue($this->subject->isFileOperationAllowed());
328  }
329 
334  {
335  $this->subject->setFileOperationPermissions(1);
336  self::assertFalse($this->subject->isDirectoryRemoveRecursivelyAllowed());
337  $this->subject->setFileOperationPermissions(15);
338  self::assertFalse($this->subject->isDirectoryRemoveRecursivelyAllowed());
339  $this->subject->setFileOperationPermissions(7);
340  self::assertFalse($this->subject->isDirectoryRemoveRecursivelyAllowed());
341  }
342 
347  {
348  $this->subject->setFileOperationPermissions(16);
349  self::assertTrue($this->subject->isDirectoryRemoveRecursivelyAllowed());
350  $this->subject->setFileOperationPermissions(31);
351  self::assertTrue($this->subject->isDirectoryRemoveRecursivelyAllowed());
352  }
353 
358  {
359  $this->subject->setFileOperationPermissions(0);
360  $this->subject->setDirectoryRemoveRecursivelyAllowed(true);
361  self::assertTrue($this->subject->isDirectoryRemoveRecursivelyAllowed());
362  }
363 
368  {
369  $this->subject->setFileOperationPermissions(0);
370  self::assertFalse($this->subject->isDirectoryCopyAllowed());
371  $this->subject->setFileOperationPermissions(7);
372  self::assertFalse($this->subject->isDirectoryCopyAllowed());
373  $this->subject->setFileOperationPermissions(23);
374  self::assertFalse($this->subject->isDirectoryCopyAllowed());
375  }
376 
381  {
382  $this->subject->setFileOperationPermissions(8);
383  self::assertTrue($this->subject->isDirectoryCopyAllowed());
384  $this->subject->setFileOperationPermissions(15);
385  self::assertTrue($this->subject->isDirectoryCopyAllowed());
386  }
387 
392  {
393  $this->subject->setFileOperationPermissions(0);
394  $this->subject->setDirectoryCopyAllowed(true);
395  self::assertTrue($this->subject->isDirectoryCopyAllowed());
396  }
397 
402  {
403  $this->subject->setFileOperationPermissions(0);
404  self::assertFalse($this->subject->isDirectoryOperationAllowed());
405  $this->subject->setFileOperationPermissions(3);
406  self::assertFalse($this->subject->isDirectoryOperationAllowed());
407  $this->subject->setFileOperationPermissions(11);
408  self::assertFalse($this->subject->isDirectoryOperationAllowed());
409  }
410 
415  {
416  $this->subject->setFileOperationPermissions(4);
417  self::assertTrue($this->subject->isDirectoryOperationAllowed());
418  $this->subject->setFileOperationPermissions(7);
419  self::assertTrue($this->subject->isDirectoryOperationAllowed());
420  }
421 
426  {
427  $this->subject->setFileOperationPermissions(0);
428  $this->subject->setDirectoryOperationAllowed(true);
429  self::assertTrue($this->subject->isDirectoryOperationAllowed());
430  }
431 
436  {
437  self::assertSame('', $this->subject->getLockToDomain());
438  }
439 
443  public function ‪setLockToDomainSetsLockToDomain()
444  {
445  $lockToDomain = 'foo.bar';
446  $this->subject->setLockToDomain($lockToDomain);
447  self::assertSame($lockToDomain, $this->subject->getLockToDomain());
448  }
449 
454  {
455  self::assertSame('', $this->subject->getTsConfig());
456  }
457 
461  public function ‪setTsConfigSetsTsConfig()
462  {
463  $tsConfig = 'foo bar';
464  $this->subject->setTsConfig($tsConfig);
465  self::assertSame($tsConfig, $this->subject->getTsConfig());
466  }
467 }
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setWorkspacePermissionSetsWorkspacePermission
‪setWorkspacePermissionSetsWorkspacePermission()
Definition: BackendUserGroupTest.php:253
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setAllowedExcludeFieldsSetsAllowedExcludeFields
‪setAllowedExcludeFieldsSetsAllowedExcludeFields()
Definition: BackendUserGroupTest.php:199
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getIsDirectoryOperationAllowedReturnsFalse
‪getIsDirectoryOperationAllowedReturnsFalse()
Definition: BackendUserGroupTest.php:400
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getDatabaseMountsInitiallyReturnsEmptyString
‪getDatabaseMountsInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:262
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getTitleInitiallyReturnsEmptyString
‪getTitleInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:40
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setPageTypesSetsPageTypes
‪setPageTypesSetsPageTypes()
Definition: BackendUserGroupTest.php:171
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getModulesInitiallyReturnsEmptyString
‪getModulesInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:119
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setTsConfigSetsTsConfig
‪setTsConfigSetsTsConfig()
Definition: BackendUserGroupTest.php:460
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setLockToDomainSetsLockToDomain
‪setLockToDomainSetsLockToDomain()
Definition: BackendUserGroupTest.php:442
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getIsDirectoryCopyAllowedReturnsFalse
‪getIsDirectoryCopyAllowedReturnsFalse()
Definition: BackendUserGroupTest.php:366
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\$subject
‪TYPO3 CMS Extbase Domain Model BackendUserGroup $subject
Definition: BackendUserGroupTest.php:29
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getTsConfigInitiallyReturnsEmptyString
‪getTsConfigInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:452
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setSubGroupsSetsSubgroups
‪setSubGroupsSetsSubgroups()
Definition: BackendUserGroupTest.php:76
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getAllowedLanguagesInitiallyReturnsEmptyString
‪getAllowedLanguagesInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:227
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest
Definition: BackendUserGroupTest.php:26
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setFileOperationPermissionsSetsFileOperationPermissions
‪setFileOperationPermissionsSetsFileOperationPermissions()
Definition: BackendUserGroupTest.php:288
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setTablesListeningSetsTablesListening
‪setTablesListeningSetsTablesListening()
Definition: BackendUserGroupTest.php:145
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setDirectoryCopyAllowedSetsDirectoryCopyAllowed
‪setDirectoryCopyAllowedSetsDirectoryCopyAllowed()
Definition: BackendUserGroupTest.php:390
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getIsDirectoryRemoveRecursivelyAllowedReturnsFalse
‪getIsDirectoryRemoveRecursivelyAllowedReturnsFalse()
Definition: BackendUserGroupTest.php:332
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getDescriptionInitiallyReturnsEmptyString
‪getDescriptionInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:58
‪TYPO3\CMS\Extbase\Persistence\ObjectStorage
Definition: ObjectStorage.php:28
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getTablesListeningInitiallyReturnsEmptyString
‪getTablesListeningInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:137
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getIsDirectoryRemoveRecursivelyAllowedReturnsTrue
‪getIsDirectoryRemoveRecursivelyAllowedReturnsTrue()
Definition: BackendUserGroupTest.php:345
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setTablesModifySetsTablesModify
‪setTablesModifySetsTablesModify()
Definition: BackendUserGroupTest.php:181
‪TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup
Definition: BackendUserGroup.php:26
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setDirectoryRemoveRecursivelyAllowedSetsDirectoryRemoveRecursivelyAllowed
‪setDirectoryRemoveRecursivelyAllowedSetsDirectoryRemoveRecursivelyAllowed()
Definition: BackendUserGroupTest.php:356
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setFileOperationAllowedSetsFileOperationAllowed
‪setFileOperationAllowedSetsFileOperationAllowed()
Definition: BackendUserGroupTest.php:322
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\allSubGroupsCanBeRemoved
‪allSubGroupsCanBeRemoved()
Definition: BackendUserGroupTest.php:104
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getPageTypesInitiallyReturnsEmptyString
‪getPageTypesInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:163
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setModulesSetsModules
‪setModulesSetsModules()
Definition: BackendUserGroupTest.php:127
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model
Definition: BackendUserGroupTest.php:16
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setDatabaseMountsSetsDatabaseMounts
‪setDatabaseMountsSetsDatabaseMounts()
Definition: BackendUserGroupTest.php:270
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getIsFileOperationAllowedReturnsFalse
‪getIsFileOperationAllowedReturnsFalse()
Definition: BackendUserGroupTest.php:298
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getIsFileOperationAllowedReturnsTrue
‪getIsFileOperationAllowedReturnsTrue()
Definition: BackendUserGroupTest.php:311
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setUp
‪setUp()
Definition: BackendUserGroupTest.php:31
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\anSubGroupCanBeRemoved
‪anSubGroupCanBeRemoved()
Definition: BackendUserGroupTest.php:86
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getAllowedExcludeFieldsInitiallyReturnsEmptyString
‪getAllowedExcludeFieldsInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:191
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getFileOperationPermissionsInitiallyReturnsZero
‪getFileOperationPermissionsInitiallyReturnsZero()
Definition: BackendUserGroupTest.php:280
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getWorkspacePermissionInitiallyReturnsFalse
‪getWorkspacePermissionInitiallyReturnsFalse()
Definition: BackendUserGroupTest.php:245
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setAllowedLanguagesSetsAllowedLanguages
‪setAllowedLanguagesSetsAllowedLanguages()
Definition: BackendUserGroupTest.php:235
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setExplicitlyAllowAndDenySetsExplicitlyAllowAndDeny
‪setExplicitlyAllowAndDenySetsExplicitlyAllowAndDeny()
Definition: BackendUserGroupTest.php:217
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getIsDirectoryCopyAllowedReturnsTrue
‪getIsDirectoryCopyAllowedReturnsTrue()
Definition: BackendUserGroupTest.php:379
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setDescriptionSetsDescription
‪setDescriptionSetsDescription()
Definition: BackendUserGroupTest.php:66
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setTitleSetsTitle
‪setTitleSetsTitle()
Definition: BackendUserGroupTest.php:48
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setDirectoryOperationAllowedSetsDirectoryOperationAllowed
‪setDirectoryOperationAllowedSetsDirectoryOperationAllowed()
Definition: BackendUserGroupTest.php:424
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getTablesModifyInitiallyReturnsEmptyString
‪getTablesModifyInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:155
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getIsDirectoryOperationAllowedReturnsTrue
‪getIsDirectoryOperationAllowedReturnsTrue()
Definition: BackendUserGroupTest.php:413
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getExplicitlyAllowAndDenyInitiallyReturnsEmptyString
‪getExplicitlyAllowAndDenyInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:209
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getLockToDomainInitiallyReturnsEmptyString
‪getLockToDomainInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:434