TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
BackendUserGroupTest.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Extbase\Tests\Unit\Domain\Model;
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 
21 {
25  protected $subject = null;
26 
27  protected function setUp()
28  {
29  $this->subject = new \TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup();
30  }
31 
36  {
37  $this->assertSame('', $this->subject->getTitle());
38  }
39 
43  public function setTitleSetsTitle()
44  {
45  $title = 'foo bar';
46  $this->subject->setTitle($title);
47  $this->assertSame($title, $this->subject->getTitle());
48  }
49 
54  {
55  $this->assertSame('', $this->subject->getDescription());
56  }
57 
62  {
63  $description = 'foo bar';
64  $this->subject->setDescription($description);
65  $this->assertSame($description, $this->subject->getDescription());
66  }
67 
71  public function setSubGroupsSetsSubgroups()
72  {
73  $subGroups = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
74  $this->subject->setSubGroups($subGroups);
75  $this->assertSame($subGroups, $this->subject->getSubGroups());
76  }
77 
81  public function anSubGroupCanBeRemoved()
82  {
83  $group1 = new \TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup();
84  $group1->setTitle('foo');
85  $group2 = new \TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup();
86  $group2->setTitle('bar');
87  $this->subject->addSubGroup($group1);
88  $this->subject->addSubGroup($group2);
89  $this->assertEquals(count($this->subject->getSubGroups()), 2);
90  $this->subject->removeSubGroup($group1);
91  $this->assertEquals(count($this->subject->getSubGroups()), 1);
92  $this->subject->removeSubGroup($group2);
93  $this->assertEquals(count($this->subject->getSubGroups()), 0);
94  }
95 
99  public function allSubGroupsCanBeRemoved()
100  {
101  $group1 = new \TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup();
102  $group1->setTitle('foo');
103  $group2 = new \TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup();
104  $group2->setTitle('bar');
105  $this->subject->addSubGroup($group1);
106  $this->subject->addSubGroup($group2);
107  $this->subject->removeAllSubGroups();
108  $this->assertEquals(count($this->subject->getSubGroups()), 0);
109  }
110 
115  {
116  $this->assertSame('', $this->subject->getModules());
117  }
118 
122  public function setModulesSetsModules()
123  {
124  $modules = 'foo,bar';
125  $this->subject->setModules($modules);
126  $this->assertSame($modules, $this->subject->getModules());
127  }
128 
133  {
134  $this->assertSame('', $this->subject->getTablesListening());
135  }
136 
141  {
142  $tablesListening = 'foo,bar';
143  $this->subject->setTablesListening($tablesListening);
144  $this->assertSame($tablesListening, $this->subject->getTablesListening());
145  }
146 
151  {
152  $this->assertSame('', $this->subject->getTablesModify());
153  }
154 
159  {
160  $this->assertSame('', $this->subject->getPageTypes());
161  }
162 
166  public function setPageTypesSetsPageTypes()
167  {
168  $pageTypes = 'foo,bar';
169  $this->subject->setPageTypes($pageTypes);
170  $this->assertSame($pageTypes, $this->subject->getPageTypes());
171  }
172 
177  {
178  $tablesModify = 'foo,bar';
179  $this->subject->setTablesModify($tablesModify);
180  $this->assertSame($tablesModify, $this->subject->getTablesModify());
181  }
182 
187  {
188  $this->assertSame('', $this->subject->getAllowedExcludeFields());
189  }
190 
195  {
196  $allowedExcludeFields = 'foo,bar';
197  $this->subject->setAllowedExcludeFields($allowedExcludeFields);
198  $this->assertSame($allowedExcludeFields, $this->subject->getAllowedExcludeFields());
199  }
200 
205  {
206  $this->assertSame('', $this->subject->getExplicitlyAllowAndDeny());
207  }
208 
213  {
214  $explicitlyAllowAndDeny = 'foo,bar';
215  $this->subject->setExplicitlyAllowAndDeny($explicitlyAllowAndDeny);
216  $this->assertSame($explicitlyAllowAndDeny, $this->subject->getExplicitlyAllowAndDeny());
217  }
218 
223  {
224  $this->assertSame('', $this->subject->getAllowedLanguages());
225  }
226 
231  {
232  $allowedLanguages = '1,0';
233  $this->subject->setAllowedLanguages($allowedLanguages);
234  $this->assertSame($allowedLanguages, $this->subject->getAllowedLanguages());
235  }
236 
241  {
242  $this->assertFalse($this->subject->getWorkspacePermission());
243  }
244 
249  {
250  $this->subject->setWorkspacePermissions(true);
251  $this->assertTrue($this->subject->getWorkspacePermission());
252  }
253 
258  {
259  $this->assertSame('', $this->subject->getDatabaseMounts());
260  }
261 
266  {
267  $mounts = '1,42';
268  $this->subject->setDatabaseMounts($mounts);
269  $this->assertSame($mounts, $this->subject->getDatabaseMounts());
270  }
271 
276  {
277  $this->assertSame(0, $this->subject->getFileOperationPermissions());
278  }
279 
284  {
285  $permission = 7;
286  $this->subject->setFileOperationPermissions($permission);
287  $this->assertSame($permission, $this->subject->getFileOperationPermissions());
288  }
289 
294  {
295  $this->subject->setFileOperationPermissions(0);
296  $this->assertFalse($this->subject->isFileOperationAllowed());
297  $this->subject->setFileOperationPermissions(2);
298  $this->assertFalse($this->subject->isFileOperationAllowed());
299  $this->subject->setFileOperationPermissions(6);
300  $this->assertFalse($this->subject->isFileOperationAllowed());
301  }
302 
307  {
308  $this->subject->setFileOperationPermissions(1);
309  $this->assertTrue($this->subject->isFileOperationAllowed());
310  $this->subject->setFileOperationPermissions(3);
311  $this->assertTrue($this->subject->isFileOperationAllowed());
312  }
313 
318  {
319  $this->subject->setFileOperationPermissions(0);
320  $this->subject->setFileOperationAllowed(true);
321  $this->assertTrue($this->subject->isFileOperationAllowed());
322  }
323 
328  {
329  $this->subject->setFileOperationPermissions(1);
330  $this->assertFalse($this->subject->isDirectoryRemoveRecursivelyAllowed());
331  $this->subject->setFileOperationPermissions(15);
332  $this->assertFalse($this->subject->isDirectoryRemoveRecursivelyAllowed());
333  $this->subject->setFileOperationPermissions(7);
334  $this->assertFalse($this->subject->isDirectoryRemoveRecursivelyAllowed());
335  }
336 
341  {
342  $this->subject->setFileOperationPermissions(16);
343  $this->assertTrue($this->subject->isDirectoryRemoveRecursivelyAllowed());
344  $this->subject->setFileOperationPermissions(31);
345  $this->assertTrue($this->subject->isDirectoryRemoveRecursivelyAllowed());
346  }
347 
352  {
353  $this->subject->setFileOperationPermissions(0);
354  $this->subject->setDirectoryRemoveRecursivelyAllowed(true);
355  $this->assertTrue($this->subject->isDirectoryRemoveRecursivelyAllowed());
356  }
357 
362  {
363  $this->subject->setFileOperationPermissions(0);
364  $this->assertFalse($this->subject->isDirectoryCopyAllowed());
365  $this->subject->setFileOperationPermissions(7);
366  $this->assertFalse($this->subject->isDirectoryCopyAllowed());
367  $this->subject->setFileOperationPermissions(23);
368  $this->assertFalse($this->subject->isDirectoryCopyAllowed());
369  }
370 
375  {
376  $this->subject->setFileOperationPermissions(8);
377  $this->assertTrue($this->subject->isDirectoryCopyAllowed());
378  $this->subject->setFileOperationPermissions(15);
379  $this->assertTrue($this->subject->isDirectoryCopyAllowed());
380  }
381 
386  {
387  $this->subject->setFileOperationPermissions(0);
388  $this->subject->setDirectoryCopyAllowed(true);
389  $this->assertTrue($this->subject->isDirectoryCopyAllowed());
390  }
391 
396  {
397  $this->subject->setFileOperationPermissions(0);
398  $this->assertFalse($this->subject->isDirectoryOperationAllowed());
399  $this->subject->setFileOperationPermissions(3);
400  $this->assertFalse($this->subject->isDirectoryOperationAllowed());
401  $this->subject->setFileOperationPermissions(11);
402  $this->assertFalse($this->subject->isDirectoryOperationAllowed());
403  }
404 
409  {
410  $this->subject->setFileOperationPermissions(4);
411  $this->assertTrue($this->subject->isDirectoryOperationAllowed());
412  $this->subject->setFileOperationPermissions(7);
413  $this->assertTrue($this->subject->isDirectoryOperationAllowed());
414  }
415 
420  {
421  $this->subject->setFileOperationPermissions(0);
422  $this->subject->setDirectoryOperationAllowed(true);
423  $this->assertTrue($this->subject->isDirectoryOperationAllowed());
424  }
425 
430  {
431  $this->assertSame('', $this->subject->getLockToDomain());
432  }
433 
438  {
439  $lockToDomain = 'foo.bar';
440  $this->subject->setLockToDomain($lockToDomain);
441  $this->assertSame($lockToDomain, $this->subject->getLockToDomain());
442  }
443 
448  {
449  $this->assertFalse($this->subject->getHideInList());
450  }
451 
455  public function setHideInListSetsHideInList()
456  {
457  $this->subject->setHideInList(true);
458  $this->assertTrue($this->subject->getHideInList());
459  }
460 
465  {
466  $this->assertSame('', $this->subject->getTsConfig());
467  }
468 
472  public function setTsConfigSetsTsConfig()
473  {
474  $tsConfig = 'foo bar';
475  $this->subject->setTsConfig($tsConfig);
476  $this->assertSame($tsConfig, $this->subject->getTsConfig());
477  }
478 }