TYPO3 CMS  TYPO3_6-2
BackendUserGroupTest.php
Go to the documentation of this file.
1 <?php
3 
21 
25  protected $fixture = NULL;
26 
27  public function setUp() {
28  $this->fixture = new \TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup();
29  }
30 
35  $this->assertSame('', $this->fixture->getTitle());
36  }
37 
41  public function setTitleSetsTitle() {
42  $title = 'foo bar';
43  $this->fixture->setTitle($title);
44  $this->assertSame($title, $this->fixture->getTitle());
45  }
46 
51  $this->assertSame('', $this->fixture->getDescription());
52  }
53 
57  public function setDescriptionSetsDescription() {
58  $description = 'foo bar';
59  $this->fixture->setDescription($description);
60  $this->assertSame($description, $this->fixture->getDescription());
61  }
62 
66  public function setSubGroupsSetsSubgroups() {
67  $subGroups = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
68  $this->fixture->setSubGroups($subGroups);
69  $this->assertSame($subGroups, $this->fixture->getSubGroups());
70  }
71 
75  public function anSubGroupCanBeRemoved() {
76  $group1 = new \TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup();
77  $group1->setTitle('foo');
78  $group2 = new \TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup();
79  $group2->setTitle('bar');
80  $this->fixture->addSubGroup($group1);
81  $this->fixture->addSubGroup($group2);
82  $this->assertEquals(count($this->fixture->getSubGroups()), 2);
83  $this->fixture->removeSubGroup($group1);
84  $this->assertEquals(count($this->fixture->getSubGroups()), 1);
85  $this->fixture->removeSubGroup($group2);
86  $this->assertEquals(count($this->fixture->getSubGroups()), 0);
87  }
88 
92  public function allSubGroupsCanBeRemoved() {
93  $group1 = new \TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup();
94  $group1->setTitle('foo');
95  $group2 = new \TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup();
96  $group2->setTitle('bar');
97  $this->fixture->addSubGroup($group1);
98  $this->fixture->addSubGroup($group2);
99  $this->fixture->removeAllSubGroups();
100  $this->assertEquals(count($this->fixture->getSubGroups()), 0);
101  }
102 
107  $this->assertSame('', $this->fixture->getModules());
108  }
109 
113  public function setModulesSetsModules() {
114  $modules = 'foo,bar';
115  $this->fixture->setModules($modules);
116  $this->assertSame($modules, $this->fixture->getModules());
117  }
118 
123  $this->assertSame('', $this->fixture->getTablesListening());
124  }
125 
130  $tablesListening = 'foo,bar';
131  $this->fixture->setTablesListening($tablesListening);
132  $this->assertSame($tablesListening, $this->fixture->getTablesListening());
133  }
134 
139  $this->assertSame('', $this->fixture->getTablesModify());
140  }
141 
146  $this->assertSame('', $this->fixture->getPageTypes());
147  }
148 
152  public function setPageTypesSetsPageTypes() {
153  $pageTypes = 'foo,bar';
154  $this->fixture->setPageTypes($pageTypes);
155  $this->assertSame($pageTypes, $this->fixture->getPageTypes());
156  }
157 
162  $tablesModify = 'foo,bar';
163  $this->fixture->setTablesModify($tablesModify);
164  $this->assertSame($tablesModify, $this->fixture->getTablesModify());
165  }
166 
171  $this->assertSame('', $this->fixture->getAllowedExcludeFields());
172  }
173 
178  $allowedExcludeFields = 'foo,bar';
179  $this->fixture->setAllowedExcludeFields($allowedExcludeFields);
180  $this->assertSame($allowedExcludeFields, $this->fixture->getAllowedExcludeFields());
181  }
182 
187  $this->assertSame('', $this->fixture->getExplicitlyAllowAndDeny());
188  }
189 
194  $explicitlyAllowAndDeny = 'foo,bar';
195  $this->fixture->setExplicitlyAllowAndDeny($explicitlyAllowAndDeny);
196  $this->assertSame($explicitlyAllowAndDeny, $this->fixture->getExplicitlyAllowAndDeny());
197  }
198 
203  $this->assertSame('', $this->fixture->getAllowedLanguages());
204  }
205 
210  $allowedLanguages = '1,0';
211  $this->fixture->setAllowedLanguages($allowedLanguages);
212  $this->assertSame($allowedLanguages, $this->fixture->getAllowedLanguages());
213  }
214 
219  $this->assertFalse($this->fixture->getWorkspacePermission());
220  }
221 
226  $this->fixture->setWorkspacePermissions(TRUE);
227  $this->assertTrue($this->fixture->getWorkspacePermission());
228  }
229 
234  $this->assertSame('', $this->fixture->getDatabaseMounts());
235  }
236 
241  $mounts = '1,42';
242  $this->fixture->setDatabaseMounts($mounts);
243  $this->assertSame($mounts, $this->fixture->getDatabaseMounts());
244  }
245 
250  $this->assertSame(0, $this->fixture->getFileOperationPermissions());
251  }
252 
257  $permission = 7;
258  $this->fixture->setFileOperationPermissions($permission);
259  $this->assertSame($permission, $this->fixture->getFileOperationPermissions());
260  }
261 
266  $this->fixture->setFileOperationPermissions(0);
267  $this->assertFalse($this->fixture->isFileOperationAllowed());
268  $this->fixture->setFileOperationPermissions(2);
269  $this->assertFalse($this->fixture->isFileOperationAllowed());
270  $this->fixture->setFileOperationPermissions(6);
271  $this->assertFalse($this->fixture->isFileOperationAllowed());
272  }
273 
278  $this->fixture->setFileOperationPermissions(1);
279  $this->assertTrue($this->fixture->isFileOperationAllowed());
280  $this->fixture->setFileOperationPermissions(3);
281  $this->assertTrue($this->fixture->isFileOperationAllowed());
282  }
283 
288  $this->fixture->setFileOperationPermissions(0);
289  $this->fixture->setFileOperationAllowed(TRUE);
290  $this->assertTrue($this->fixture->isFileOperationAllowed());
291  }
292 
297  $this->fixture->setFileOperationPermissions(0);
298  $this->assertFalse($this->fixture->isFileUnzipAllowed());
299  $this->fixture->setFileOperationPermissions(1);
300  $this->assertFalse($this->fixture->isFileUnzipAllowed());
301  $this->fixture->setFileOperationPermissions(5);
302  $this->assertFalse($this->fixture->isFileUnzipAllowed());
303  }
304 
309  $this->fixture->setFileOperationPermissions(2);
310  $this->assertTrue($this->fixture->isFileUnzipAllowed());
311  $this->fixture->setFileOperationPermissions(3);
312  $this->assertTrue($this->fixture->isFileUnzipAllowed());
313  }
314 
319  $this->fixture->setFileOperationPermissions(0);
320  $this->fixture->setFileUnzipAllowed(TRUE);
321  $this->assertTrue($this->fixture->isFileUnzipAllowed());
322  }
323 
328  $this->fixture->setFileOperationPermissions(1);
329  $this->assertFalse($this->fixture->isDirectoryRemoveRecursivelyAllowed());
330  $this->fixture->setFileOperationPermissions(15);
331  $this->assertFalse($this->fixture->isDirectoryRemoveRecursivelyAllowed());
332  $this->fixture->setFileOperationPermissions(7);
333  $this->assertFalse($this->fixture->isDirectoryRemoveRecursivelyAllowed());
334  }
335 
340  $this->fixture->setFileOperationPermissions(16);
341  $this->assertTrue($this->fixture->isDirectoryRemoveRecursivelyAllowed());
342  $this->fixture->setFileOperationPermissions(31);
343  $this->assertTrue($this->fixture->isDirectoryRemoveRecursivelyAllowed());
344  }
345 
350  $this->fixture->setFileOperationPermissions(0);
351  $this->fixture->setDirectoryRemoveRecursivelyAllowed(TRUE);
352  $this->assertTrue($this->fixture->isDirectoryRemoveRecursivelyAllowed());
353  }
354 
359  $this->fixture->setFileOperationPermissions(0);
360  $this->assertFalse($this->fixture->isDirectoryCopyAllowed());
361  $this->fixture->setFileOperationPermissions(7);
362  $this->assertFalse($this->fixture->isDirectoryCopyAllowed());
363  $this->fixture->setFileOperationPermissions(23);
364  $this->assertFalse($this->fixture->isDirectoryCopyAllowed());
365  }
366 
371  $this->fixture->setFileOperationPermissions(8);
372  $this->assertTrue($this->fixture->isDirectoryCopyAllowed());
373  $this->fixture->setFileOperationPermissions(15);
374  $this->assertTrue($this->fixture->isDirectoryCopyAllowed());
375  }
376 
381  $this->fixture->setFileOperationPermissions(0);
382  $this->fixture->setDirectoryCopyAllowed(TRUE);
383  $this->assertTrue($this->fixture->isDirectoryCopyAllowed());
384  }
385 
390  $this->fixture->setFileOperationPermissions(0);
391  $this->assertFalse($this->fixture->isDirectoryOperationAllowed());
392  $this->fixture->setFileOperationPermissions(3);
393  $this->assertFalse($this->fixture->isDirectoryOperationAllowed());
394  $this->fixture->setFileOperationPermissions(11);
395  $this->assertFalse($this->fixture->isDirectoryOperationAllowed());
396  }
397 
402  $this->fixture->setFileOperationPermissions(4);
403  $this->assertTrue($this->fixture->isDirectoryOperationAllowed());
404  $this->fixture->setFileOperationPermissions(7);
405  $this->assertTrue($this->fixture->isDirectoryOperationAllowed());
406  }
407 
412  $this->fixture->setFileOperationPermissions(0);
413  $this->fixture->setDirectoryoperationAllowed(TRUE);
414  $this->assertTrue($this->fixture->isDirectoryOperationAllowed());
415  }
416 
421  $this->assertSame('', $this->fixture->getLockToDomain());
422  }
423 
428  $lockToDomain = 'foo.bar';
429  $this->fixture->setLockToDomain($lockToDomain);
430  $this->assertSame($lockToDomain, $this->fixture->getLockToDomain());
431  }
432 
437  $this->assertFalse($this->fixture->getHideInList());
438  }
439 
443  public function setHideInListSetsHideInList() {
444  $this->fixture->setHideInList(TRUE);
445  $this->assertTrue($this->fixture->getHideInList());
446  }
447 
452  $this->assertSame('', $this->fixture->getTsConfig());
453  }
454 
458  public function setTsConfigSetsTsConfig() {
459  $tsConfig = 'foo bar';
460  $this->fixture->setTsConfig($tsConfig);
461  $this->assertSame($tsConfig, $this->fixture->getTsConfig());
462  }
463 }