TYPO3 CMS  TYPO3_7-6
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 
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(0);
330  $this->assertFalse($this->subject->isFileUnzipAllowed());
331  $this->subject->setFileOperationPermissions(1);
332  $this->assertFalse($this->subject->isFileUnzipAllowed());
333  $this->subject->setFileOperationPermissions(5);
334  $this->assertFalse($this->subject->isFileUnzipAllowed());
335  }
336 
341  {
342  $this->subject->setFileOperationPermissions(2);
343  $this->assertTrue($this->subject->isFileUnzipAllowed());
344  $this->subject->setFileOperationPermissions(3);
345  $this->assertTrue($this->subject->isFileUnzipAllowed());
346  }
347 
352  {
353  $this->subject->setFileOperationPermissions(0);
354  $this->subject->setFileUnzipAllowed(true);
355  $this->assertTrue($this->subject->isFileUnzipAllowed());
356  }
357 
362  {
363  $this->subject->setFileOperationPermissions(1);
364  $this->assertFalse($this->subject->isDirectoryRemoveRecursivelyAllowed());
365  $this->subject->setFileOperationPermissions(15);
366  $this->assertFalse($this->subject->isDirectoryRemoveRecursivelyAllowed());
367  $this->subject->setFileOperationPermissions(7);
368  $this->assertFalse($this->subject->isDirectoryRemoveRecursivelyAllowed());
369  }
370 
375  {
376  $this->subject->setFileOperationPermissions(16);
377  $this->assertTrue($this->subject->isDirectoryRemoveRecursivelyAllowed());
378  $this->subject->setFileOperationPermissions(31);
379  $this->assertTrue($this->subject->isDirectoryRemoveRecursivelyAllowed());
380  }
381 
386  {
387  $this->subject->setFileOperationPermissions(0);
388  $this->subject->setDirectoryRemoveRecursivelyAllowed(true);
389  $this->assertTrue($this->subject->isDirectoryRemoveRecursivelyAllowed());
390  }
391 
396  {
397  $this->subject->setFileOperationPermissions(0);
398  $this->assertFalse($this->subject->isDirectoryCopyAllowed());
399  $this->subject->setFileOperationPermissions(7);
400  $this->assertFalse($this->subject->isDirectoryCopyAllowed());
401  $this->subject->setFileOperationPermissions(23);
402  $this->assertFalse($this->subject->isDirectoryCopyAllowed());
403  }
404 
409  {
410  $this->subject->setFileOperationPermissions(8);
411  $this->assertTrue($this->subject->isDirectoryCopyAllowed());
412  $this->subject->setFileOperationPermissions(15);
413  $this->assertTrue($this->subject->isDirectoryCopyAllowed());
414  }
415 
420  {
421  $this->subject->setFileOperationPermissions(0);
422  $this->subject->setDirectoryCopyAllowed(true);
423  $this->assertTrue($this->subject->isDirectoryCopyAllowed());
424  }
425 
430  {
431  $this->subject->setFileOperationPermissions(0);
432  $this->assertFalse($this->subject->isDirectoryOperationAllowed());
433  $this->subject->setFileOperationPermissions(3);
434  $this->assertFalse($this->subject->isDirectoryOperationAllowed());
435  $this->subject->setFileOperationPermissions(11);
436  $this->assertFalse($this->subject->isDirectoryOperationAllowed());
437  }
438 
443  {
444  $this->subject->setFileOperationPermissions(4);
445  $this->assertTrue($this->subject->isDirectoryOperationAllowed());
446  $this->subject->setFileOperationPermissions(7);
447  $this->assertTrue($this->subject->isDirectoryOperationAllowed());
448  }
449 
454  {
455  $this->subject->setFileOperationPermissions(0);
456  $this->subject->setDirectoryoperationAllowed(true);
457  $this->assertTrue($this->subject->isDirectoryOperationAllowed());
458  }
459 
464  {
465  $this->assertSame('', $this->subject->getLockToDomain());
466  }
467 
472  {
473  $lockToDomain = 'foo.bar';
474  $this->subject->setLockToDomain($lockToDomain);
475  $this->assertSame($lockToDomain, $this->subject->getLockToDomain());
476  }
477 
482  {
483  $this->assertFalse($this->subject->getHideInList());
484  }
485 
489  public function setHideInListSetsHideInList()
490  {
491  $this->subject->setHideInList(true);
492  $this->assertTrue($this->subject->getHideInList());
493  }
494 
499  {
500  $this->assertSame('', $this->subject->getTsConfig());
501  }
502 
506  public function setTsConfigSetsTsConfig()
507  {
508  $tsConfig = 'foo bar';
509  $this->subject->setTsConfig($tsConfig);
510  $this->assertSame($tsConfig, $this->subject->getTsConfig());
511  }
512 }