[BUGFIX] Add missing namespace parts
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Unit / Domain / Model / FrontendUserGroupTest.php
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
17 /**
18 * Test case
19 */
20 class FrontendUserGroupTest extends \TYPO3\Components\TestingFramework\Core\Unit\UnitTestCase
21 {
22 /**
23 * @var \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup
24 */
25 protected $subject = null;
26
27 protected function setUp()
28 {
29 $this->subject = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup();
30 }
31
32 /**
33 * @test
34 */
35 public function getTitleInitiallyReturnsEmptyString()
36 {
37 $this->subject = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup();
38 $this->assertSame('', $this->subject->getTitle());
39 }
40
41 /**
42 * @test
43 */
44 public function getTitleInitiallyReturnsGivenTitleFromConstruct()
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
51 /**
52 * @test
53 */
54 public function setTitleSetsTitle()
55 {
56 $title = 'foo bar';
57 $this->subject->setTitle($title);
58 $this->assertSame($title, $this->subject->getTitle());
59 }
60
61 /**
62 * @test
63 */
64 public function getLockToDomainInitiallyReturnsEmptyString()
65 {
66 $this->assertSame('', $this->subject->getLockToDomain());
67 }
68
69 /**
70 * @test
71 */
72 public function setLockToDomainSetsLockToDomain()
73 {
74 $lockToDomain = 'foo.bar';
75 $this->subject->setLockToDomain($lockToDomain);
76 $this->assertSame($lockToDomain, $this->subject->getLockToDomain());
77 }
78
79 /**
80 * @test
81 */
82 public function getDescriptionInitiallyReturnsEmptyString()
83 {
84 $this->assertSame('', $this->subject->getDescription());
85 }
86
87 /**
88 * @test
89 */
90 public function setDescriptionSetsDescription()
91 {
92 $description = 'foo bar';
93 $this->subject->setDescription($description);
94 $this->assertSame($description, $this->subject->getDescription());
95 }
96
97 /**
98 * @test
99 */
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
108 /**
109 * @test
110 */
111 public function removeSubgroupRemovesSubgroup()
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
124 /**
125 * @test
126 */
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 }