TYPO3 CMS  TYPO3_6-2
FrontendUserGroupTest.php
Go to the documentation of this file.
1 <?php
3 
21 
25  protected $fixture = NULL;
26 
27  public function setUp() {
28  $this->fixture = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup();
29  }
30 
35  $this->fixture = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup();
36  $this->assertSame('', $this->fixture->getTitle());
37  }
38 
43  $title = 'foo bar';
44  $this->fixture = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup($title);
45  $this->assertSame($title, $this->fixture->getTitle());
46  }
47 
51  public function setTitleSetsTitle() {
52  $title = 'foo bar';
53  $this->fixture->setTitle($title);
54  $this->assertSame($title, $this->fixture->getTitle());
55  }
56 
61  $this->assertSame('', $this->fixture->getLockToDomain());
62  }
63 
67  public function setLockToDomainSetsLockToDomain() {
68  $lockToDomain = 'foo.bar';
69  $this->fixture->setLockToDomain($lockToDomain);
70  $this->assertSame($lockToDomain, $this->fixture->getLockToDomain());
71  }
72 
77  $this->assertSame('', $this->fixture->getDescription());
78  }
79 
83  public function setDescriptionSetsDescription() {
84  $description = 'foo bar';
85  $this->fixture->setDescription($description);
86  $this->assertSame($description, $this->fixture->getDescription());
87  }
88 
92  public function addSubgroupAddsSubgroup() {
93  $group1 = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup('foo');
94  $this->assertEquals(count($this->fixture->getSubgroup()), 0);
95  $this->fixture->addSubgroup($group1);
96  $this->assertEquals(count($this->fixture->getSubgroup()), 1);
97  }
98 
102  public function removeSubgroupRemovesSubgroup() {
103  $group1 = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup('foo');
104  $group2 = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup('bar');
105  $this->fixture->addSubgroup($group1);
106  $this->fixture->addSubgroup($group2);
107  $this->assertEquals(count($this->fixture->getSubgroup()), 2);
108  $this->fixture->removeSubgroup($group1);
109  $this->assertEquals(count($this->fixture->getSubgroup()), 1);
110  $this->fixture->removeSubgroup($group2);
111  $this->assertEquals(count($this->fixture->getSubgroup()), 0);
112  }
113 
117  public function setSubgroupSetsSubgroups() {
118  $subgroup = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
119  $group = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup('foo');
120  $subgroup->attach($group);
121  $this->fixture->setSubgroup($subgroup);
122  $this->assertSame($subgroup, $this->fixture->getSubgroup());
123  }
124 }