TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
extbase/Tests/Unit/Domain/Model/BackendUserTest.php
Go to the documentation of this file.
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 
21 {
25  protected $subject = null;
26 
27  protected function setUp()
28  {
29  $this->subject = new \TYPO3\CMS\Extbase\Domain\Model\BackendUser();
30  }
31 
36  {
37  $this->assertSame('', $this->subject->getUserName());
38  }
39 
43  public function setUserNameSetsUserName()
44  {
45  $userName = 'don.juan';
46  $this->subject->setUserName($userName);
47  $this->assertSame($userName, $this->subject->getUserName());
48  }
49 
54  {
55  $this->assertFalse($this->subject->getIsAdministrator());
56  }
57 
62  {
63  $this->subject->setIsAdministrator(true);
64  $this->assertTrue($this->subject->getIsAdministrator());
65  }
66 
71  {
72  $this->assertFalse($this->subject->getIsDisabled());
73  }
74 
79  {
80  $this->subject->setIsDisabled(true);
81  $this->assertTrue($this->subject->getIsDisabled());
82  }
83 
88  {
89  $this->assertNull($this->subject->getStartDateAndTime());
90  }
91 
96  {
97  $date = new \DateTime();
98  $this->subject->setStartDateAndTime($date);
99  $this->assertSame($date, $this->subject->getStartDateAndTime());
100  }
101 
106  {
107  $this->assertNull($this->subject->getEndDateAndTime());
108  }
109 
114  {
115  $date = new \DateTime();
116  $this->subject->setEndDateAndTime($date);
117  $this->assertSame($date, $this->subject->getEndDateAndTime());
118  }
119 
124  {
125  $this->assertTrue($this->subject->isActivated());
126  }
127 
132  {
133  $this->subject->setIsDisabled(true);
134  $this->assertFalse($this->subject->isActivated());
135  }
136 
141  {
142  $tomorrow = new \DateTime('tomorrow');
143  $this->subject->setStartDateAndTime($tomorrow);
144  $this->assertFalse($this->subject->isActivated());
145  }
146 
151  {
152  $yesterday = new \DateTime('yesterday');
153  $this->subject->setStartDateAndTime($yesterday);
154  $this->assertTrue($this->subject->isActivated());
155  }
156 
161  {
162  $tomorrow = new \DateTime('tomorrow');
163  $this->subject->setEndDateAndTime($tomorrow);
164  $this->assertTrue($this->subject->isActivated());
165  }
166 
171  {
172  $yesterday = new \DateTime('yesterday');
173  $this->subject->setEndDateAndTime($yesterday);
174  $this->assertFalse($this->subject->isActivated());
175  }
176 
181  {
182  $yesterday = new \DateTime('yesterday');
183  $this->subject->setStartDateAndTime($yesterday);
184  $tomorrow = new \DateTime('tomorrow');
185  $this->subject->setEndDateAndTime($tomorrow);
186  $this->assertTrue($this->subject->isActivated());
187  }
188 
193  {
194  $yesterday = new \DateTime('yesterday');
195  $this->subject->setStartDateAndTime($yesterday);
196  $this->subject->setEndDateAndTime($yesterday);
197  $this->assertFalse($this->subject->isActivated());
198  }
199 
204  {
205  $tomorrow = new \DateTime('tomorrow');
206  $this->subject->setStartDateAndTime($tomorrow);
207  $this->subject->setEndDateAndTime($tomorrow);
208  $this->assertFalse($this->subject->isActivated());
209  }
210 
215  {
216  $this->assertSame('', $this->subject->getEmail());
217  }
218 
222  public function setEmailSetsEmail()
223  {
224  $email = 'don.juan@example.com';
225  $this->subject->setEmail($email);
226  $this->assertSame($email, $this->subject->getEmail());
227  }
228 
233  {
234  $this->assertSame('', $this->subject->getRealName());
235  }
236 
240  public function setRealNameSetsRealName()
241  {
242  $realName = 'Don Juan';
243  $this->subject->setRealName($realName);
244  $this->assertSame($realName, $this->subject->getRealName());
245  }
246 
251  {
252  $this->assertFalse($this->subject->getIpLockIsDisabled());
253  }
254 
259  {
260  $this->subject->setIpLockIsDisabled(true);
261  $this->assertTrue($this->subject->getIpLockIsDisabled());
262  }
263 
268  {
269  $this->assertNull($this->subject->getLastLoginDateAndTime());
270  }
271 
276  {
277  $date = new \DateTime();
278  $this->subject->setLastLoginDateAndTime($date);
279  $this->assertSame($date, $this->subject->getLastLoginDateAndTime());
280  }
281 }