‪TYPO3CMS  9.5
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 
17 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
18 
22 class ‪FrontendUserGroupTest extends UnitTestCase
23 {
27  protected ‪$subject;
28 
29  protected function ‪setUp()
30  {
31  $this->subject = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup();
32  }
33 
38  {
39  $this->subject = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup();
40  $this->assertSame('', $this->subject->getTitle());
41  }
42 
47  {
48  $title = 'foo bar';
49  $this->subject = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup($title);
50  $this->assertSame($title, $this->subject->getTitle());
51  }
52 
56  public function ‪setTitleSetsTitle()
57  {
58  $title = 'foo bar';
59  $this->subject->setTitle($title);
60  $this->assertSame($title, $this->subject->getTitle());
61  }
62 
67  {
68  $this->assertSame('', $this->subject->getLockToDomain());
69  }
70 
74  public function ‪setLockToDomainSetsLockToDomain()
75  {
76  $lockToDomain = 'foo.bar';
77  $this->subject->setLockToDomain($lockToDomain);
78  $this->assertSame($lockToDomain, $this->subject->getLockToDomain());
79  }
80 
85  {
86  $this->assertSame('', $this->subject->getDescription());
87  }
88 
92  public function ‪setDescriptionSetsDescription()
93  {
94  $description = 'foo bar';
95  $this->subject->setDescription($description);
96  $this->assertSame($description, $this->subject->getDescription());
97  }
98 
102  public function ‪addSubgroupAddsSubgroup()
103  {
104  $group1 = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup('foo');
105  $this->assertEquals(count($this->subject->getSubgroup()), 0);
106  $this->subject->addSubgroup($group1);
107  $this->assertEquals(count($this->subject->getSubgroup()), 1);
108  }
109 
113  public function ‪removeSubgroupRemovesSubgroup()
114  {
115  $group1 = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup('foo');
116  $group2 = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup('bar');
117  $this->subject->addSubgroup($group1);
118  $this->subject->addSubgroup($group2);
119  $this->assertEquals(count($this->subject->getSubgroup()), 2);
120  $this->subject->removeSubgroup($group1);
121  $this->assertEquals(count($this->subject->getSubgroup()), 1);
122  $this->subject->removeSubgroup($group2);
123  $this->assertEquals(count($this->subject->getSubgroup()), 0);
124  }
125 
129  public function ‪setSubgroupSetsSubgroups()
130  {
131  $subgroup = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
132  $group = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup('foo');
133  $subgroup->attach($group);
134  $this->subject->setSubgroup($subgroup);
135  $this->assertSame($subgroup, $this->subject->getSubgroup());
136  }
137 }
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\setTitleSetsTitle
‪setTitleSetsTitle()
Definition: FrontendUserGroupTest.php:55
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\setUp
‪setUp()
Definition: FrontendUserGroupTest.php:28
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\getLockToDomainInitiallyReturnsEmptyString
‪getLockToDomainInitiallyReturnsEmptyString()
Definition: FrontendUserGroupTest.php:65
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\setLockToDomainSetsLockToDomain
‪setLockToDomainSetsLockToDomain()
Definition: FrontendUserGroupTest.php:73
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\getDescriptionInitiallyReturnsEmptyString
‪getDescriptionInitiallyReturnsEmptyString()
Definition: FrontendUserGroupTest.php:83
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\getTitleInitiallyReturnsGivenTitleFromConstruct
‪getTitleInitiallyReturnsGivenTitleFromConstruct()
Definition: FrontendUserGroupTest.php:45
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\getTitleInitiallyReturnsEmptyString
‪getTitleInitiallyReturnsEmptyString()
Definition: FrontendUserGroupTest.php:36
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model
Definition: BackendUserGroupTest.php:2
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\setSubgroupSetsSubgroups
‪setSubgroupSetsSubgroups()
Definition: FrontendUserGroupTest.php:128
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\removeSubgroupRemovesSubgroup
‪removeSubgroupRemovesSubgroup()
Definition: FrontendUserGroupTest.php:112
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\$subject
‪TYPO3 CMS Extbase Domain Model FrontendUserGroup $subject
Definition: FrontendUserGroupTest.php:26
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest
Definition: FrontendUserGroupTest.php:23
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\addSubgroupAddsSubgroup
‪addSubgroupAddsSubgroup()
Definition: FrontendUserGroupTest.php:101
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\setDescriptionSetsDescription
‪setDescriptionSetsDescription()
Definition: FrontendUserGroupTest.php:91