TYPO3 CMS  TYPO3_8-7
FrontendUserGroupTest.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 
20 class FrontendUserGroupTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
21 {
25  protected $subject = null;
26 
27  protected function setUp()
28  {
29  $this->subject = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup();
30  }
31 
36  {
37  $this->subject = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup();
38  $this->assertSame('', $this->subject->getTitle());
39  }
40 
45  {
46  $title = 'foo bar';
47  $this->subject = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup($title);
48  $this->assertSame($title, $this->subject->getTitle());
49  }
50 
54  public function setTitleSetsTitle()
55  {
56  $title = 'foo bar';
57  $this->subject->setTitle($title);
58  $this->assertSame($title, $this->subject->getTitle());
59  }
60 
65  {
66  $this->assertSame('', $this->subject->getLockToDomain());
67  }
68 
73  {
74  $lockToDomain = 'foo.bar';
75  $this->subject->setLockToDomain($lockToDomain);
76  $this->assertSame($lockToDomain, $this->subject->getLockToDomain());
77  }
78 
83  {
84  $this->assertSame('', $this->subject->getDescription());
85  }
86 
91  {
92  $description = 'foo bar';
93  $this->subject->setDescription($description);
94  $this->assertSame($description, $this->subject->getDescription());
95  }
96 
100  public function addSubgroupAddsSubgroup()
101  {
102  $group1 = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup('foo');
103  $this->assertEquals(count($this->subject->getSubgroup()), 0);
104  $this->subject->addSubgroup($group1);
105  $this->assertEquals(count($this->subject->getSubgroup()), 1);
106  }
107 
112  {
113  $group1 = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup('foo');
114  $group2 = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup('bar');
115  $this->subject->addSubgroup($group1);
116  $this->subject->addSubgroup($group2);
117  $this->assertEquals(count($this->subject->getSubgroup()), 2);
118  $this->subject->removeSubgroup($group1);
119  $this->assertEquals(count($this->subject->getSubgroup()), 1);
120  $this->subject->removeSubgroup($group2);
121  $this->assertEquals(count($this->subject->getSubgroup()), 0);
122  }
123 
127  public function setSubgroupSetsSubgroups()
128  {
129  $subgroup = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
130  $group = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup('foo');
131  $subgroup->attach($group);
132  $this->subject->setSubgroup($subgroup);
133  $this->assertSame($subgroup, $this->subject->getSubgroup());
134  }
135 }