[TASK] Shorten the extend class in all unit tests
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Unit / Domain / Model / BackendUserTest.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 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
18
19 /**
20 * Test case
21 */
22 class BackendUserTest extends UnitTestCase
23 {
24 /**
25 * @var \TYPO3\CMS\Extbase\Domain\Model\BackendUser
26 */
27 protected $subject;
28
29 protected function setUp()
30 {
31 $this->subject = new \TYPO3\CMS\Extbase\Domain\Model\BackendUser();
32 }
33
34 /**
35 * @test
36 */
37 public function getUserNameInitiallyReturnsEmptyString()
38 {
39 $this->assertSame('', $this->subject->getUserName());
40 }
41
42 /**
43 * @test
44 */
45 public function setUserNameSetsUserName()
46 {
47 $userName = 'don.juan';
48 $this->subject->setUserName($userName);
49 $this->assertSame($userName, $this->subject->getUserName());
50 }
51
52 /**
53 * @test
54 */
55 public function getIsAdministratorInitiallyReturnsFalse()
56 {
57 $this->assertFalse($this->subject->getIsAdministrator());
58 }
59
60 /**
61 * @test
62 */
63 public function setIsAdministratorCanSetIsAdministratorToTrue()
64 {
65 $this->subject->setIsAdministrator(true);
66 $this->assertTrue($this->subject->getIsAdministrator());
67 }
68
69 /**
70 * @test
71 */
72 public function getIsDisabledInitiallyReturnsFalse()
73 {
74 $this->assertFalse($this->subject->getIsDisabled());
75 }
76
77 /**
78 * @test
79 */
80 public function setIsDisabledCanSetIsDisabledToTrue()
81 {
82 $this->subject->setIsDisabled(true);
83 $this->assertTrue($this->subject->getIsDisabled());
84 }
85
86 /**
87 * @test
88 */
89 public function getStartDateAndTimeInitiallyReturnsNull()
90 {
91 $this->assertNull($this->subject->getStartDateAndTime());
92 }
93
94 /**
95 * @test
96 */
97 public function setStartDateAndTimeSetsStartDateAndTime()
98 {
99 $date = new \DateTime();
100 $this->subject->setStartDateAndTime($date);
101 $this->assertSame($date, $this->subject->getStartDateAndTime());
102 }
103
104 /**
105 * @test
106 */
107 public function getEndDateAndTimeInitiallyReturnsNull()
108 {
109 $this->assertNull($this->subject->getEndDateAndTime());
110 }
111
112 /**
113 * @test
114 */
115 public function setEndDateAndTimeSetsEndDateAndTime()
116 {
117 $date = new \DateTime();
118 $this->subject->setEndDateAndTime($date);
119 $this->assertSame($date, $this->subject->getEndDateAndTime());
120 }
121
122 /**
123 * @test
124 */
125 public function isActivatedInitiallyReturnsTrue()
126 {
127 $this->assertTrue($this->subject->isActivated());
128 }
129
130 /**
131 * @test
132 */
133 public function isActivatedForDisabledReturnsFalse()
134 {
135 $this->subject->setIsDisabled(true);
136 $this->assertFalse($this->subject->isActivated());
137 }
138
139 /**
140 * @test
141 */
142 public function isActivatedForStartDateAndTimeInFutureReturnsFalse()
143 {
144 $tomorrow = new \DateTime('tomorrow');
145 $this->subject->setStartDateAndTime($tomorrow);
146 $this->assertFalse($this->subject->isActivated());
147 }
148
149 /**
150 * @test
151 */
152 public function isActivatedForStartDateAndTimeInPastReturnsTrue()
153 {
154 $yesterday = new \DateTime('yesterday');
155 $this->subject->setStartDateAndTime($yesterday);
156 $this->assertTrue($this->subject->isActivated());
157 }
158
159 /**
160 * @test
161 */
162 public function isActivatedForEndDateAndTimeInFutureReturnsTrue()
163 {
164 $tomorrow = new \DateTime('tomorrow');
165 $this->subject->setEndDateAndTime($tomorrow);
166 $this->assertTrue($this->subject->isActivated());
167 }
168
169 /**
170 * @test
171 */
172 public function isActivatedForEndDateAndTimeInPastReturnsFalse()
173 {
174 $yesterday = new \DateTime('yesterday');
175 $this->subject->setEndDateAndTime($yesterday);
176 $this->assertFalse($this->subject->isActivated());
177 }
178
179 /**
180 * @test
181 */
182 public function isActivatedForStartDateAndTimeInPastEndDateAndTimeInFutureReturnsTrue()
183 {
184 $yesterday = new \DateTime('yesterday');
185 $this->subject->setStartDateAndTime($yesterday);
186 $tomorrow = new \DateTime('tomorrow');
187 $this->subject->setEndDateAndTime($tomorrow);
188 $this->assertTrue($this->subject->isActivated());
189 }
190
191 /**
192 * @test
193 */
194 public function isActivatedForStartDateAndTimeInPastEndDateAndTimeInPastReturnsFalse()
195 {
196 $yesterday = new \DateTime('yesterday');
197 $this->subject->setStartDateAndTime($yesterday);
198 $this->subject->setEndDateAndTime($yesterday);
199 $this->assertFalse($this->subject->isActivated());
200 }
201
202 /**
203 * @test
204 */
205 public function isActivatedForStartDateAndTimeInFutureEndDateAndTimeInFutureReturnsFalse()
206 {
207 $tomorrow = new \DateTime('tomorrow');
208 $this->subject->setStartDateAndTime($tomorrow);
209 $this->subject->setEndDateAndTime($tomorrow);
210 $this->assertFalse($this->subject->isActivated());
211 }
212
213 /**
214 * @test
215 */
216 public function getEmailInitiallyReturnsEmptyString()
217 {
218 $this->assertSame('', $this->subject->getEmail());
219 }
220
221 /**
222 * @test
223 */
224 public function setEmailSetsEmail()
225 {
226 $email = 'don.juan@example.com';
227 $this->subject->setEmail($email);
228 $this->assertSame($email, $this->subject->getEmail());
229 }
230
231 /**
232 * @test
233 */
234 public function getRealNameInitiallyReturnsEmptyString()
235 {
236 $this->assertSame('', $this->subject->getRealName());
237 }
238
239 /**
240 * @test
241 */
242 public function setRealNameSetsRealName()
243 {
244 $realName = 'Don Juan';
245 $this->subject->setRealName($realName);
246 $this->assertSame($realName, $this->subject->getRealName());
247 }
248
249 /**
250 * @test
251 */
252 public function getIpLockIsDisabledInitiallyReturnsFalse()
253 {
254 $this->assertFalse($this->subject->getIpLockIsDisabled());
255 }
256
257 /**
258 * @test
259 */
260 public function setIpLockIsDisabledCanSetIpLockIsDisabledToTrue()
261 {
262 $this->subject->setIpLockIsDisabled(true);
263 $this->assertTrue($this->subject->getIpLockIsDisabled());
264 }
265
266 /**
267 * @test
268 */
269 public function getLastLoginDateAndTimeInitiallyReturnsNull()
270 {
271 $this->assertNull($this->subject->getLastLoginDateAndTime());
272 }
273
274 /**
275 * @test
276 */
277 public function setLastLoginDateAndTimeSetsLastLoginDateAndTime()
278 {
279 $date = new \DateTime();
280 $this->subject->setLastLoginDateAndTime($date);
281 $this->assertSame($date, $this->subject->getLastLoginDateAndTime());
282 }
283 }