2 /***************************************************************
5 * (c) 2012 Markus Günther <mail@markus-guenther>
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
19 * This script is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * This copyright notice MUST APPEAR in all copies of the script!
25 ***************************************************************/
28 * Testcase for Tx_Extbase_Domain_Model_BackendUserGroup.
30 * @author Markus Günther <mail@markus-guenther>
33 * @subpackage Domain\Model
39 class Tx_Extbase_Tests_Unit_Domain_Model_BackendUserGroupTest
extends Tx_Extbase_Tests_Unit_BaseTestCase
{
42 * @var Tx_Extbase_Domain_Model_BackendUserGroup
44 protected $fixture = NULL;
46 public function setUp() {
47 $this->fixture
= new Tx_Extbase_Domain_Model_BackendUserGroup();
50 public function tearDown() {
51 unset($this->fixture
);
57 public function getTitleInitiallyReturnsEmptyString() {
60 $this->fixture
->getTitle()
67 public function setTitleSetsTitle() {
69 $this->fixture
->setTitle($title);
73 $this->fixture
->getTitle()
80 public function getDescriptionInitiallyReturnsEmptyString() {
83 $this->fixture
->getDescription()
90 public function setDescriptionSetsDescription() {
91 $description = 'foo bar';
92 $this->fixture
->setDescription($description);
96 $this->fixture
->getDescription()
103 public function setSubGroupsSetsSubgroups() {
104 $subGroups = new Tx_Extbase_Persistence_ObjectStorage();
105 $this->fixture
->setSubGroups($subGroups);
109 $this->fixture
->getSubGroups()
116 public function anSubGroupCanBeRemoved() {
117 $group1 = new Tx_Extbase_Domain_Model_BackendUserGroup
;
118 $group1->setTitle('foo');
119 $group2 = new Tx_Extbase_Domain_Model_BackendUserGroup
;
120 $group2->setTitle('bar');
122 $this->fixture
->addSubGroup($group1);
123 $this->fixture
->addSubGroup($group2);
124 $this->assertEquals(count($this->fixture
->getSubGroups()), 2);
125 $this->fixture
->removeSubGroup($group1);
126 $this->assertEquals(count($this->fixture
->getSubGroups()), 1);
127 $this->fixture
->removeSubGroup($group2);
128 $this->assertEquals(count($this->fixture
->getSubGroups()), 0);
134 public function allSubGroupsCanBeRemoved() {
135 $group1 = new Tx_Extbase_Domain_Model_BackendUserGroup
;
136 $group1->setTitle('foo');
137 $group2 = new Tx_Extbase_Domain_Model_BackendUserGroup
;
138 $group2->setTitle('bar');
140 $this->fixture
->addSubGroup($group1);
141 $this->fixture
->addSubGroup($group2);
142 $this->fixture
->removeAllSubGroups();
144 $this->assertEquals(count($this->fixture
->getSubGroups()), 0);
150 public function getModulesInitiallyReturnsEmptyString() {
153 $this->fixture
->getModules()
160 public function setModulesSetsModules() {
161 $modules = 'foo,bar';
162 $this->fixture
->setModules($modules);
166 $this->fixture
->getModules()
173 public function getTablesListeningInitiallyReturnsEmptyString() {
176 $this->fixture
->getTablesListening()
183 public function setTablesListeningSetsTablesListening() {
184 $tablesListening = 'foo,bar';
185 $this->fixture
->setTablesListening($tablesListening);
189 $this->fixture
->getTablesListening()
196 public function getTablesModifyInitiallyReturnsEmptyString() {
199 $this->fixture
->getTablesModify()
206 public function getPageTypesInitiallyReturnsEmptyString() {
209 $this->fixture
->getPageTypes()
216 public function setPageTypesSetsPageTypes() {
217 $pageTypes = 'foo,bar';
218 $this->fixture
->setPageTypes($pageTypes);
222 $this->fixture
->getPageTypes()
229 public function setTablesModifySetsTablesModify() {
230 $tablesModify = 'foo,bar';
231 $this->fixture
->setTablesModify($tablesModify);
235 $this->fixture
->getTablesModify()
242 public function getAllowedExcludeFieldsInitiallyReturnsEmptyString() {
245 $this->fixture
->getAllowedExcludeFields()
252 public function setAllowedExcludeFieldsSetsAllowedExcludeFields() {
253 $allowedExcludeFields = 'foo,bar';
254 $this->fixture
->setAllowedExcludeFields($allowedExcludeFields);
257 $allowedExcludeFields,
258 $this->fixture
->getAllowedExcludeFields()
265 public function getExplicitlyAllowAndDenyInitiallyReturnsEmptyString() {
268 $this->fixture
->getExplicitlyAllowAndDeny()
275 public function setExplicitlyAllowAndDenySetsExplicitlyAllowAndDeny() {
276 $explicitlyAllowAndDeny = 'foo,bar';
277 $this->fixture
->setExplicitlyAllowAndDeny($explicitlyAllowAndDeny);
280 $explicitlyAllowAndDeny,
281 $this->fixture
->getExplicitlyAllowAndDeny()
288 public function getAllowedLanguagesInitiallyReturnsEmptyString() {
291 $this->fixture
->getAllowedLanguages()
298 public function setAllowedLanguagesSetsAllowedLanguages() {
299 $allowedLanguages = '1,0';
300 $this->fixture
->setAllowedLanguages($allowedLanguages);
304 $this->fixture
->getAllowedLanguages()
311 public function getWorkspacePermissionInitiallyReturnsFalse() {
313 $this->fixture
->getWorkspacePermission()
320 public function setWorkspacePermissionSetsWorkspacePermission() {
321 $this->fixture
->setWorkspacePermissions(TRUE);
324 $this->fixture
->getWorkspacePermission()
331 public function getDatabaseMountsInitiallyReturnsEmptyString() {
334 $this->fixture
->getDatabaseMounts()
341 public function setDatabaseMountsSetsDatabaseMounts() {
343 $this->fixture
->setDatabaseMounts($mounts);
347 $this->fixture
->getDatabaseMounts()
354 public function getFileOperationPermissionsInitiallyReturnsZero() {
357 $this->fixture
->getFileOperationPermissions()
364 public function setFileOperationPermissionsSetsFileOperationPermissions() {
366 $this->fixture
->setFileOperationPermissions($permission);
370 $this->fixture
->getFileOperationPermissions()
377 public function getIsFileOperationAllowedReturnsFalse() {
378 $this->fixture
->setFileOperationPermissions(0);
380 $this->fixture
->isFileOperationAllowed()
383 $this->fixture
->setFileOperationPermissions(2);
385 $this->fixture
->isFileOperationAllowed()
388 $this->fixture
->setFileOperationPermissions(6);
390 $this->fixture
->isFileOperationAllowed()
397 public function getIsFileOperationAllowedReturnsTrue() {
398 $this->fixture
->setFileOperationPermissions(1);
400 $this->fixture
->isFileOperationAllowed()
403 $this->fixture
->setFileOperationPermissions(3);
405 $this->fixture
->isFileOperationAllowed()
412 public function setFileOperationAllowedSetsFileOperationAllowed() {
413 $this->fixture
->setFileOperationPermissions(0);
414 $this->fixture
->setFileOperationAllowed(TRUE);
417 $this->fixture
->isFileOperationAllowed()
424 public function getIsFileUnzipAllowedReturnsFalse() {
425 $this->fixture
->setFileOperationPermissions(0);
427 $this->fixture
->isFileUnzipAllowed()
430 $this->fixture
->setFileOperationPermissions(1);
432 $this->fixture
->isFileUnzipAllowed()
435 $this->fixture
->setFileOperationPermissions(5);
437 $this->fixture
->isFileUnzipAllowed()
444 public function getIsFileUnzipAllowedReturnsTrue() {
445 $this->fixture
->setFileOperationPermissions(2);
447 $this->fixture
->isFileUnzipAllowed()
450 $this->fixture
->setFileOperationPermissions(3);
452 $this->fixture
->isFileUnzipAllowed()
459 public function setFileUnzipAllowedSetsFileUnzipAllowed() {
460 $this->fixture
->setFileOperationPermissions(0);
461 $this->fixture
->setFileUnzipAllowed(TRUE);
464 $this->fixture
->isFileUnzipAllowed()
471 public function getIsDirectoryRemoveRecursivelyAllowedReturnsFalse() {
472 $this->fixture
->setFileOperationPermissions(1);
474 $this->fixture
->isDirectoryRemoveRecursivelyAllowed()
477 $this->fixture
->setFileOperationPermissions(15);
479 $this->fixture
->isDirectoryRemoveRecursivelyAllowed()
482 $this->fixture
->setFileOperationPermissions(7);
484 $this->fixture
->isDirectoryRemoveRecursivelyAllowed()
491 public function getIsDirectoryRemoveRecursivelyAllowedReturnsTrue() {
492 $this->fixture
->setFileOperationPermissions(16);
494 $this->fixture
->isDirectoryRemoveRecursivelyAllowed()
497 $this->fixture
->setFileOperationPermissions(31);
499 $this->fixture
->isDirectoryRemoveRecursivelyAllowed()
506 public function setDirectoryRemoveRecursivelyAllowedSetsDirectoryRemoveRecursivelyAllowed() {
507 $this->fixture
->setFileOperationPermissions(0);
508 $this->fixture
->setDirectoryRemoveRecursivelyAllowed(TRUE);
511 $this->fixture
->isDirectoryRemoveRecursivelyAllowed()
518 public function getIsDirectoryCopyAllowedReturnsFalse() {
519 $this->fixture
->setFileOperationPermissions(0);
521 $this->fixture
->isDirectoryCopyAllowed()
524 $this->fixture
->setFileOperationPermissions(7);
526 $this->fixture
->isDirectoryCopyAllowed()
529 $this->fixture
->setFileOperationPermissions(23);
531 $this->fixture
->isDirectoryCopyAllowed()
538 public function getIsDirectoryCopyAllowedReturnsTrue() {
539 $this->fixture
->setFileOperationPermissions(8);
541 $this->fixture
->isDirectoryCopyAllowed()
544 $this->fixture
->setFileOperationPermissions(15);
546 $this->fixture
->isDirectoryCopyAllowed()
553 public function setDirectoryCopyAllowedSetsDirectoryCopyAllowed() {
554 $this->fixture
->setFileOperationPermissions(0);
555 $this->fixture
->setDirectoryCopyAllowed(TRUE);
558 $this->fixture
->isDirectoryCopyAllowed()
565 public function getIsDirectoryOperationAllowedReturnsFalse() {
566 $this->fixture
->setFileOperationPermissions(0);
568 $this->fixture
->isDirectoryOperationAllowed()
571 $this->fixture
->setFileOperationPermissions(3);
573 $this->fixture
->isDirectoryOperationAllowed()
576 $this->fixture
->setFileOperationPermissions(11);
578 $this->fixture
->isDirectoryOperationAllowed()
585 public function getIsDirectoryOperationAllowedReturnsTrue() {
586 $this->fixture
->setFileOperationPermissions(4);
588 $this->fixture
->isDirectoryOperationAllowed()
591 $this->fixture
->setFileOperationPermissions(7);
593 $this->fixture
->isDirectoryOperationAllowed()
600 public function setDirectoryOperationAllowedSetsDirectoryOperationAllowed() {
601 $this->fixture
->setFileOperationPermissions(0);
602 $this->fixture
->setDirectoryoperationAllowed(TRUE);
605 $this->fixture
->isDirectoryOperationAllowed()
612 public function getLockToDomainInitiallyReturnsEmptyString() {
615 $this->fixture
->getLockToDomain()
622 public function setLockToDomainSetsLockToDomain() {
623 $lockToDomain = 'foo.bar';
624 $this->fixture
->setLockToDomain($lockToDomain);
628 $this->fixture
->getLockToDomain()
635 public function getHideInListInitiallyReturnsFalse() {
637 $this->fixture
->getHideInList()
644 public function setHideInListSetsHideInList() {
645 $this->fixture
->setHideInList(TRUE);
648 $this->fixture
->getHideInList()
655 public function getTsConfigInitiallyReturnsEmptyString() {
658 $this->fixture
->getTsConfig()
665 public function setTsConfigSetsTsConfig() {
666 $tsConfig = 'foo bar';
667 $this->fixture
->setTsConfig($tsConfig);
671 $this->fixture
->getTsConfig()