‪TYPO3CMS  9.5
BackendUserGroupTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
17 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
18 
22 class ‪BackendUserGroupTest extends UnitTestCase
23 {
27  protected ‪$subject;
28 
29  protected function ‪setUp()
30  {
31  $this->subject = new \TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup();
32  }
33 
38  {
39  $this->assertSame('', $this->subject->getTitle());
40  }
41 
45  public function ‪setTitleSetsTitle()
46  {
47  $title = 'foo bar';
48  $this->subject->setTitle($title);
49  $this->assertSame($title, $this->subject->getTitle());
50  }
51 
56  {
57  $this->assertSame('', $this->subject->getDescription());
58  }
59 
63  public function ‪setDescriptionSetsDescription()
64  {
65  $description = 'foo bar';
66  $this->subject->setDescription($description);
67  $this->assertSame($description, $this->subject->getDescription());
68  }
69 
73  public function ‪setSubGroupsSetsSubgroups()
74  {
75  $subGroups = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
76  $this->subject->setSubGroups($subGroups);
77  $this->assertSame($subGroups, $this->subject->getSubGroups());
78  }
79 
83  public function ‪anSubGroupCanBeRemoved()
84  {
85  $group1 = new \TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup();
86  $group1->setTitle('foo');
87  $group2 = new \TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup();
88  $group2->setTitle('bar');
89  $this->subject->addSubGroup($group1);
90  $this->subject->addSubGroup($group2);
91  $this->assertEquals(count($this->subject->getSubGroups()), 2);
92  $this->subject->removeSubGroup($group1);
93  $this->assertEquals(count($this->subject->getSubGroups()), 1);
94  $this->subject->removeSubGroup($group2);
95  $this->assertEquals(count($this->subject->getSubGroups()), 0);
96  }
97 
101  public function ‪allSubGroupsCanBeRemoved()
102  {
103  $group1 = new \TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup();
104  $group1->setTitle('foo');
105  $group2 = new \TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup();
106  $group2->setTitle('bar');
107  $this->subject->addSubGroup($group1);
108  $this->subject->addSubGroup($group2);
109  $this->subject->removeAllSubGroups();
110  $this->assertEquals(count($this->subject->getSubGroups()), 0);
111  }
112 
117  {
118  $this->assertSame('', $this->subject->getModules());
119  }
120 
124  public function ‪setModulesSetsModules()
125  {
126  $modules = 'foo,bar';
127  $this->subject->setModules($modules);
128  $this->assertSame($modules, $this->subject->getModules());
129  }
130 
135  {
136  $this->assertSame('', $this->subject->getTablesListening());
137  }
138 
143  {
144  $tablesListening = 'foo,bar';
145  $this->subject->setTablesListening($tablesListening);
146  $this->assertSame($tablesListening, $this->subject->getTablesListening());
147  }
148 
153  {
154  $this->assertSame('', $this->subject->getTablesModify());
155  }
156 
161  {
162  $this->assertSame('', $this->subject->getPageTypes());
163  }
164 
168  public function ‪setPageTypesSetsPageTypes()
169  {
170  $pageTypes = 'foo,bar';
171  $this->subject->setPageTypes($pageTypes);
172  $this->assertSame($pageTypes, $this->subject->getPageTypes());
173  }
174 
178  public function ‪setTablesModifySetsTablesModify()
179  {
180  $tablesModify = 'foo,bar';
181  $this->subject->setTablesModify($tablesModify);
182  $this->assertSame($tablesModify, $this->subject->getTablesModify());
183  }
184 
189  {
190  $this->assertSame('', $this->subject->getAllowedExcludeFields());
191  }
192 
197  {
198  $allowedExcludeFields = 'foo,bar';
199  $this->subject->setAllowedExcludeFields($allowedExcludeFields);
200  $this->assertSame($allowedExcludeFields, $this->subject->getAllowedExcludeFields());
201  }
202 
207  {
208  $this->assertSame('', $this->subject->getExplicitlyAllowAndDeny());
209  }
210 
215  {
216  $explicitlyAllowAndDeny = 'foo,bar';
217  $this->subject->setExplicitlyAllowAndDeny($explicitlyAllowAndDeny);
218  $this->assertSame($explicitlyAllowAndDeny, $this->subject->getExplicitlyAllowAndDeny());
219  }
220 
225  {
226  $this->assertSame('', $this->subject->getAllowedLanguages());
227  }
228 
233  {
234  $allowedLanguages = '1,0';
235  $this->subject->setAllowedLanguages($allowedLanguages);
236  $this->assertSame($allowedLanguages, $this->subject->getAllowedLanguages());
237  }
238 
243  {
244  $this->assertFalse($this->subject->getWorkspacePermission());
245  }
246 
251  {
252  $this->subject->setWorkspacePermissions(true);
253  $this->assertTrue($this->subject->getWorkspacePermission());
254  }
255 
260  {
261  $this->assertSame('', $this->subject->getDatabaseMounts());
262  }
263 
268  {
269  $mounts = '1,42';
270  $this->subject->setDatabaseMounts($mounts);
271  $this->assertSame($mounts, $this->subject->getDatabaseMounts());
272  }
273 
278  {
279  $this->assertSame(0, $this->subject->getFileOperationPermissions());
280  }
281 
286  {
287  $permission = 7;
288  $this->subject->setFileOperationPermissions($permission);
289  $this->assertSame($permission, $this->subject->getFileOperationPermissions());
290  }
291 
296  {
297  $this->subject->setFileOperationPermissions(0);
298  $this->assertFalse($this->subject->isFileOperationAllowed());
299  $this->subject->setFileOperationPermissions(2);
300  $this->assertFalse($this->subject->isFileOperationAllowed());
301  $this->subject->setFileOperationPermissions(6);
302  $this->assertFalse($this->subject->isFileOperationAllowed());
303  }
304 
309  {
310  $this->subject->setFileOperationPermissions(1);
311  $this->assertTrue($this->subject->isFileOperationAllowed());
312  $this->subject->setFileOperationPermissions(3);
313  $this->assertTrue($this->subject->isFileOperationAllowed());
314  }
315 
320  {
321  $this->subject->setFileOperationPermissions(0);
322  $this->subject->setFileOperationAllowed(true);
323  $this->assertTrue($this->subject->isFileOperationAllowed());
324  }
325 
330  {
331  $this->subject->setFileOperationPermissions(1);
332  $this->assertFalse($this->subject->isDirectoryRemoveRecursivelyAllowed());
333  $this->subject->setFileOperationPermissions(15);
334  $this->assertFalse($this->subject->isDirectoryRemoveRecursivelyAllowed());
335  $this->subject->setFileOperationPermissions(7);
336  $this->assertFalse($this->subject->isDirectoryRemoveRecursivelyAllowed());
337  }
338 
343  {
344  $this->subject->setFileOperationPermissions(16);
345  $this->assertTrue($this->subject->isDirectoryRemoveRecursivelyAllowed());
346  $this->subject->setFileOperationPermissions(31);
347  $this->assertTrue($this->subject->isDirectoryRemoveRecursivelyAllowed());
348  }
349 
354  {
355  $this->subject->setFileOperationPermissions(0);
356  $this->subject->setDirectoryRemoveRecursivelyAllowed(true);
357  $this->assertTrue($this->subject->isDirectoryRemoveRecursivelyAllowed());
358  }
359 
364  {
365  $this->subject->setFileOperationPermissions(0);
366  $this->assertFalse($this->subject->isDirectoryCopyAllowed());
367  $this->subject->setFileOperationPermissions(7);
368  $this->assertFalse($this->subject->isDirectoryCopyAllowed());
369  $this->subject->setFileOperationPermissions(23);
370  $this->assertFalse($this->subject->isDirectoryCopyAllowed());
371  }
372 
377  {
378  $this->subject->setFileOperationPermissions(8);
379  $this->assertTrue($this->subject->isDirectoryCopyAllowed());
380  $this->subject->setFileOperationPermissions(15);
381  $this->assertTrue($this->subject->isDirectoryCopyAllowed());
382  }
383 
388  {
389  $this->subject->setFileOperationPermissions(0);
390  $this->subject->setDirectoryCopyAllowed(true);
391  $this->assertTrue($this->subject->isDirectoryCopyAllowed());
392  }
393 
398  {
399  $this->subject->setFileOperationPermissions(0);
400  $this->assertFalse($this->subject->isDirectoryOperationAllowed());
401  $this->subject->setFileOperationPermissions(3);
402  $this->assertFalse($this->subject->isDirectoryOperationAllowed());
403  $this->subject->setFileOperationPermissions(11);
404  $this->assertFalse($this->subject->isDirectoryOperationAllowed());
405  }
406 
411  {
412  $this->subject->setFileOperationPermissions(4);
413  $this->assertTrue($this->subject->isDirectoryOperationAllowed());
414  $this->subject->setFileOperationPermissions(7);
415  $this->assertTrue($this->subject->isDirectoryOperationAllowed());
416  }
417 
422  {
423  $this->subject->setFileOperationPermissions(0);
424  $this->subject->setDirectoryOperationAllowed(true);
425  $this->assertTrue($this->subject->isDirectoryOperationAllowed());
426  }
427 
432  {
433  $this->assertSame('', $this->subject->getLockToDomain());
434  }
435 
439  public function ‪setLockToDomainSetsLockToDomain()
440  {
441  $lockToDomain = 'foo.bar';
442  $this->subject->setLockToDomain($lockToDomain);
443  $this->assertSame($lockToDomain, $this->subject->getLockToDomain());
444  }
445 
450  {
451  $this->assertSame('', $this->subject->getTsConfig());
452  }
453 
457  public function ‪setTsConfigSetsTsConfig()
458  {
459  $tsConfig = 'foo bar';
460  $this->subject->setTsConfig($tsConfig);
461  $this->assertSame($tsConfig, $this->subject->getTsConfig());
462  }
463 }
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setWorkspacePermissionSetsWorkspacePermission
‪setWorkspacePermissionSetsWorkspacePermission()
Definition: BackendUserGroupTest.php:249
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setAllowedExcludeFieldsSetsAllowedExcludeFields
‪setAllowedExcludeFieldsSetsAllowedExcludeFields()
Definition: BackendUserGroupTest.php:195
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getIsDirectoryOperationAllowedReturnsFalse
‪getIsDirectoryOperationAllowedReturnsFalse()
Definition: BackendUserGroupTest.php:396
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getDatabaseMountsInitiallyReturnsEmptyString
‪getDatabaseMountsInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:258
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getTitleInitiallyReturnsEmptyString
‪getTitleInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:36
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setPageTypesSetsPageTypes
‪setPageTypesSetsPageTypes()
Definition: BackendUserGroupTest.php:167
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getModulesInitiallyReturnsEmptyString
‪getModulesInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:115
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setTsConfigSetsTsConfig
‪setTsConfigSetsTsConfig()
Definition: BackendUserGroupTest.php:456
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setLockToDomainSetsLockToDomain
‪setLockToDomainSetsLockToDomain()
Definition: BackendUserGroupTest.php:438
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getIsDirectoryCopyAllowedReturnsFalse
‪getIsDirectoryCopyAllowedReturnsFalse()
Definition: BackendUserGroupTest.php:362
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\$subject
‪TYPO3 CMS Extbase Domain Model BackendUserGroup $subject
Definition: BackendUserGroupTest.php:26
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getTsConfigInitiallyReturnsEmptyString
‪getTsConfigInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:448
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setSubGroupsSetsSubgroups
‪setSubGroupsSetsSubgroups()
Definition: BackendUserGroupTest.php:72
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getAllowedLanguagesInitiallyReturnsEmptyString
‪getAllowedLanguagesInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:223
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest
Definition: BackendUserGroupTest.php:23
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setFileOperationPermissionsSetsFileOperationPermissions
‪setFileOperationPermissionsSetsFileOperationPermissions()
Definition: BackendUserGroupTest.php:284
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setTablesListeningSetsTablesListening
‪setTablesListeningSetsTablesListening()
Definition: BackendUserGroupTest.php:141
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setDirectoryCopyAllowedSetsDirectoryCopyAllowed
‪setDirectoryCopyAllowedSetsDirectoryCopyAllowed()
Definition: BackendUserGroupTest.php:386
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getIsDirectoryRemoveRecursivelyAllowedReturnsFalse
‪getIsDirectoryRemoveRecursivelyAllowedReturnsFalse()
Definition: BackendUserGroupTest.php:328
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getDescriptionInitiallyReturnsEmptyString
‪getDescriptionInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:54
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getTablesListeningInitiallyReturnsEmptyString
‪getTablesListeningInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:133
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getIsDirectoryRemoveRecursivelyAllowedReturnsTrue
‪getIsDirectoryRemoveRecursivelyAllowedReturnsTrue()
Definition: BackendUserGroupTest.php:341
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setTablesModifySetsTablesModify
‪setTablesModifySetsTablesModify()
Definition: BackendUserGroupTest.php:177
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setDirectoryRemoveRecursivelyAllowedSetsDirectoryRemoveRecursivelyAllowed
‪setDirectoryRemoveRecursivelyAllowedSetsDirectoryRemoveRecursivelyAllowed()
Definition: BackendUserGroupTest.php:352
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setFileOperationAllowedSetsFileOperationAllowed
‪setFileOperationAllowedSetsFileOperationAllowed()
Definition: BackendUserGroupTest.php:318
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\allSubGroupsCanBeRemoved
‪allSubGroupsCanBeRemoved()
Definition: BackendUserGroupTest.php:100
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getPageTypesInitiallyReturnsEmptyString
‪getPageTypesInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:159
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setModulesSetsModules
‪setModulesSetsModules()
Definition: BackendUserGroupTest.php:123
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model
Definition: BackendUserGroupTest.php:2
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setDatabaseMountsSetsDatabaseMounts
‪setDatabaseMountsSetsDatabaseMounts()
Definition: BackendUserGroupTest.php:266
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getIsFileOperationAllowedReturnsFalse
‪getIsFileOperationAllowedReturnsFalse()
Definition: BackendUserGroupTest.php:294
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getIsFileOperationAllowedReturnsTrue
‪getIsFileOperationAllowedReturnsTrue()
Definition: BackendUserGroupTest.php:307
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setUp
‪setUp()
Definition: BackendUserGroupTest.php:28
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\anSubGroupCanBeRemoved
‪anSubGroupCanBeRemoved()
Definition: BackendUserGroupTest.php:82
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getAllowedExcludeFieldsInitiallyReturnsEmptyString
‪getAllowedExcludeFieldsInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:187
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getFileOperationPermissionsInitiallyReturnsZero
‪getFileOperationPermissionsInitiallyReturnsZero()
Definition: BackendUserGroupTest.php:276
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getWorkspacePermissionInitiallyReturnsFalse
‪getWorkspacePermissionInitiallyReturnsFalse()
Definition: BackendUserGroupTest.php:241
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setAllowedLanguagesSetsAllowedLanguages
‪setAllowedLanguagesSetsAllowedLanguages()
Definition: BackendUserGroupTest.php:231
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setExplicitlyAllowAndDenySetsExplicitlyAllowAndDeny
‪setExplicitlyAllowAndDenySetsExplicitlyAllowAndDeny()
Definition: BackendUserGroupTest.php:213
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getIsDirectoryCopyAllowedReturnsTrue
‪getIsDirectoryCopyAllowedReturnsTrue()
Definition: BackendUserGroupTest.php:375
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setDescriptionSetsDescription
‪setDescriptionSetsDescription()
Definition: BackendUserGroupTest.php:62
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setTitleSetsTitle
‪setTitleSetsTitle()
Definition: BackendUserGroupTest.php:44
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\setDirectoryOperationAllowedSetsDirectoryOperationAllowed
‪setDirectoryOperationAllowedSetsDirectoryOperationAllowed()
Definition: BackendUserGroupTest.php:420
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getTablesModifyInitiallyReturnsEmptyString
‪getTablesModifyInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:151
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getIsDirectoryOperationAllowedReturnsTrue
‪getIsDirectoryOperationAllowedReturnsTrue()
Definition: BackendUserGroupTest.php:409
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getExplicitlyAllowAndDenyInitiallyReturnsEmptyString
‪getExplicitlyAllowAndDenyInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:205
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\BackendUserGroupTest\getLockToDomainInitiallyReturnsEmptyString
‪getLockToDomainInitiallyReturnsEmptyString()
Definition: BackendUserGroupTest.php:430