‪TYPO3CMS  10.4
FrontendUserGroupTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
20 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
21 
25 class ‪FrontendUserGroupTest extends UnitTestCase
26 {
30  protected ‪$subject;
31 
32  protected function ‪setUp(): void
33  {
34  parent::setUp();
35  $this->subject = new ‪FrontendUserGroup();
36  }
37 
42  {
43  $this->subject = new ‪FrontendUserGroup();
44  self::assertSame('', $this->subject->getTitle());
45  }
46 
51  {
52  $title = 'foo bar';
53  $this->subject = new FrontendUserGroup($title);
54  self::assertSame($title, $this->subject->getTitle());
55  }
56 
60  public function ‪setTitleSetsTitle()
61  {
62  $title = 'foo bar';
63  $this->subject->setTitle($title);
64  self::assertSame($title, $this->subject->getTitle());
65  }
66 
71  {
72  self::assertSame('', $this->subject->getLockToDomain());
73  }
74 
78  public function ‪setLockToDomainSetsLockToDomain()
79  {
80  $lockToDomain = 'foo.bar';
81  $this->subject->setLockToDomain($lockToDomain);
82  self::assertSame($lockToDomain, $this->subject->getLockToDomain());
83  }
84 
89  {
90  self::assertSame('', $this->subject->getDescription());
91  }
92 
96  public function ‪setDescriptionSetsDescription()
97  {
98  $description = 'foo bar';
99  $this->subject->setDescription($description);
100  self::assertSame($description, $this->subject->getDescription());
101  }
102 
106  public function ‪addSubgroupAddsSubgroup()
107  {
108  $group1 = new FrontendUserGroup('foo');
109  self::assertEquals(count($this->subject->getSubgroup()), 0);
110  $this->subject->addSubgroup($group1);
111  self::assertEquals(count($this->subject->getSubgroup()), 1);
112  }
113 
117  public function ‪removeSubgroupRemovesSubgroup()
118  {
119  $group1 = new FrontendUserGroup('foo');
120  $group2 = new FrontendUserGroup('bar');
121  $this->subject->addSubgroup($group1);
122  $this->subject->addSubgroup($group2);
123  self::assertEquals(count($this->subject->getSubgroup()), 2);
124  $this->subject->removeSubgroup($group1);
125  self::assertEquals(count($this->subject->getSubgroup()), 1);
126  $this->subject->removeSubgroup($group2);
127  self::assertEquals(count($this->subject->getSubgroup()), 0);
128  }
129 
133  public function ‪setSubgroupSetsSubgroups()
134  {
135  $subgroup = new ObjectStorage();
136  $group = new FrontendUserGroup('foo');
137  $subgroup->attach($group);
138  $this->subject->setSubgroup($subgroup);
139  self::assertSame($subgroup, $this->subject->getSubgroup());
140  }
141 }
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\setTitleSetsTitle
‪setTitleSetsTitle()
Definition: FrontendUserGroupTest.php:59
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\setUp
‪setUp()
Definition: FrontendUserGroupTest.php:31
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\getLockToDomainInitiallyReturnsEmptyString
‪getLockToDomainInitiallyReturnsEmptyString()
Definition: FrontendUserGroupTest.php:69
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\setLockToDomainSetsLockToDomain
‪setLockToDomainSetsLockToDomain()
Definition: FrontendUserGroupTest.php:77
‪TYPO3\CMS\Extbase\Persistence\ObjectStorage
Definition: ObjectStorage.php:28
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\getDescriptionInitiallyReturnsEmptyString
‪getDescriptionInitiallyReturnsEmptyString()
Definition: FrontendUserGroupTest.php:87
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\getTitleInitiallyReturnsGivenTitleFromConstruct
‪getTitleInitiallyReturnsGivenTitleFromConstruct()
Definition: FrontendUserGroupTest.php:49
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\getTitleInitiallyReturnsEmptyString
‪getTitleInitiallyReturnsEmptyString()
Definition: FrontendUserGroupTest.php:40
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model
Definition: BackendUserGroupTest.php:16
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\setSubgroupSetsSubgroups
‪setSubgroupSetsSubgroups()
Definition: FrontendUserGroupTest.php:132
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\removeSubgroupRemovesSubgroup
‪removeSubgroupRemovesSubgroup()
Definition: FrontendUserGroupTest.php:116
‪TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup
Definition: FrontendUserGroup.php:25
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\$subject
‪TYPO3 CMS Extbase Domain Model FrontendUserGroup $subject
Definition: FrontendUserGroupTest.php:29
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest
Definition: FrontendUserGroupTest.php:26
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\addSubgroupAddsSubgroup
‪addSubgroupAddsSubgroup()
Definition: FrontendUserGroupTest.php:105
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserGroupTest\setDescriptionSetsDescription
‪setDescriptionSetsDescription()
Definition: FrontendUserGroupTest.php:95