[BUGFIX] Add missing namespace parts
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Unit / Domain / Model / FrontendUserTest.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 /**
18 * Test case
19 */
20 class FrontendUserTest extends \TYPO3\Components\TestingFramework\Core\Unit\UnitTestCase
21 {
22 /**
23 * @var \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
24 */
25 protected $subject = null;
26
27 protected function setUp()
28 {
29 $this->subject = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUser();
30 }
31
32 /**
33 * @test
34 */
35 public function getUsernameInitiallyReturnsEmptyString()
36 {
37 $this->assertSame('', $this->subject->getUsername());
38 }
39
40 /**
41 * @test
42 */
43 public function setUsernameSetsUsername()
44 {
45 $username = 'don.juan';
46 $this->subject->setUsername($username);
47 $this->assertSame($username, $this->subject->getUsername());
48 }
49
50 /**
51 * @test
52 */
53 public function getPasswordInitiallyReturnsEmptyString()
54 {
55 $this->assertSame('', $this->subject->getPassword());
56 }
57
58 /**
59 * @test
60 */
61 public function setPasswordSetsPassword()
62 {
63 $password = 'f00Bar';
64 $this->subject->setPassword($password);
65 $this->assertSame($password, $this->subject->getPassword());
66 }
67
68 /**
69 * @test
70 */
71 public function setUsergroupSetsUsergroup()
72 {
73 $usergroup = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
74 $usergroup->attach(new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup('foo'));
75 $this->subject->setUsergroup($usergroup);
76 $this->assertSame($usergroup, $this->subject->getUsergroup());
77 }
78
79 /**
80 * @test
81 */
82 public function addUsergroupAddsUserGroup()
83 {
84 $usergroup = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup('foo');
85 $this->assertEquals(count($this->subject->getUsergroup()), 0);
86 $this->subject->addUsergroup($usergroup);
87 $this->assertEquals(count($this->subject->getUsergroup()), 1);
88 }
89
90 /**
91 * @test
92 */
93 public function removeUsergroupRemovesUsergroup()
94 {
95 $usergroup = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup('foo');
96 $this->subject->addUsergroup($usergroup);
97 $this->assertEquals(count($this->subject->getUsergroup()), 1);
98 $this->subject->removeUsergroup($usergroup);
99 $this->assertEquals(count($this->subject->getUsergroup()), 0);
100 }
101
102 /**
103 * @test
104 */
105 public function getNameInitiallyReturnsEmptyString()
106 {
107 $this->assertSame('', $this->subject->getName());
108 }
109
110 /**
111 * @test
112 */
113 public function setNameSetsName()
114 {
115 $name = 'don juan';
116 $this->subject->setName($name);
117 $this->assertSame($name, $this->subject->getName());
118 }
119
120 /**
121 * @test
122 */
123 public function getFirstNameInitiallyReturnsEmptyString()
124 {
125 $this->assertSame('', $this->subject->getFirstName());
126 }
127
128 /**
129 * @test
130 */
131 public function setFirstNameSetsFirstName()
132 {
133 $firstName = 'don';
134 $this->subject->setFirstName($firstName);
135 $this->assertSame($firstName, $this->subject->getFirstName());
136 }
137
138 /**
139 * @test
140 */
141 public function getMiddleNameInitiallyReturnsEmptyString()
142 {
143 $this->assertSame('', $this->subject->getMiddleName());
144 }
145
146 /**
147 * @test
148 */
149 public function setMiddleNameSetsMiddleName()
150 {
151 $middleName = 'miguel';
152 $this->subject->setMiddleName($middleName);
153 $this->assertSame($middleName, $this->subject->getMiddleName());
154 }
155
156 /**
157 * @test
158 */
159 public function getLastNameInitiallyReturnsEmptyString()
160 {
161 $this->assertSame('', $this->subject->getLastName());
162 }
163
164 /**
165 * @test
166 */
167 public function setLastNameSetsLastName()
168 {
169 $lastName = 'juan';
170 $this->subject->setLastName($lastName);
171 $this->assertSame($lastName, $this->subject->getLastName());
172 }
173
174 /**
175 * @test
176 */
177 public function getAddressInitiallyReturnsEmptyString()
178 {
179 $this->assertSame('', $this->subject->getAddress());
180 }
181
182 /**
183 * @test
184 */
185 public function setAddressSetsAddress()
186 {
187 $address = 'foobar 42, foo';
188 $this->subject->setAddress($address);
189 $this->assertSame($address, $this->subject->getAddress());
190 }
191
192 /**
193 * @test
194 */
195 public function getTelephoneInitiallyReturnsEmptyString()
196 {
197 $this->assertSame('', $this->subject->getTelephone());
198 }
199
200 /**
201 * @test
202 */
203 public function setTelephoneSetsTelephone()
204 {
205 $telephone = '42';
206 $this->subject->setTelephone($telephone);
207 $this->assertSame($telephone, $this->subject->getTelephone());
208 }
209
210 /**
211 * @test
212 */
213 public function getFaxInitiallyReturnsEmptyString()
214 {
215 $this->assertSame('', $this->subject->getFax());
216 }
217
218 /**
219 * @test
220 */
221 public function setFaxSetsFax()
222 {
223 $fax = '42';
224 $this->subject->setFax($fax);
225 $this->assertSame($fax, $this->subject->getFax());
226 }
227
228 /**
229 * @test
230 */
231 public function getEmailInitiallyReturnsEmptyString()
232 {
233 $this->assertSame('', $this->subject->getEmail());
234 }
235
236 /**
237 * @test
238 */
239 public function setEmailSetsEmail()
240 {
241 $email = 'don.juan@example.com';
242 $this->subject->setEmail($email);
243 $this->assertSame($email, $this->subject->getEmail());
244 }
245
246 /**
247 * @test
248 */
249 public function getLockToDomainInitiallyReturnsEmptyString()
250 {
251 $this->assertSame('', $this->subject->getLockToDomain());
252 }
253
254 /**
255 * @test
256 */
257 public function setLockToDomainSetsLockToDomain()
258 {
259 $lockToDomain = 'foo.bar';
260 $this->subject->setLockToDomain($lockToDomain);
261 $this->assertSame($lockToDomain, $this->subject->getLockToDomain());
262 }
263
264 /**
265 * @test
266 */
267 public function getTitleInitiallyReturnsEmptyString()
268 {
269 $this->assertSame('', $this->subject->getTitle());
270 }
271
272 /**
273 * @test
274 */
275 public function setTitleSetsTitle()
276 {
277 $title = 'foobar';
278 $this->subject->setTitle($title);
279 $this->assertSame($title, $this->subject->getTitle());
280 }
281
282 /**
283 * @test
284 */
285 public function getZipInitiallyReturnsEmptyString()
286 {
287 $this->assertSame('', $this->subject->getZip());
288 }
289
290 /**
291 * @test
292 */
293 public function setZipSetsZip()
294 {
295 $zip = '42';
296 $this->subject->setZip($zip);
297 $this->assertSame($zip, $this->subject->getZip());
298 }
299
300 /**
301 * @test
302 */
303 public function getCityInitiallyReturnsEmptyString()
304 {
305 $this->assertSame('', $this->subject->getCity());
306 }
307
308 /**
309 * @test
310 */
311 public function setCitySetsCity()
312 {
313 $city = 'foo';
314 $this->subject->setCity($city);
315 $this->assertSame($city, $this->subject->getCity());
316 }
317
318 /**
319 * @test
320 */
321 public function getCountryInitiallyReturnsEmptyString()
322 {
323 $this->assertSame('', $this->subject->getCountry());
324 }
325
326 /**
327 * @test
328 */
329 public function setCountrySetsCountry()
330 {
331 $country = 'foo';
332 $this->subject->setCountry($country);
333 $this->assertSame($country, $this->subject->getCountry());
334 }
335
336 /**
337 * @test
338 */
339 public function getWwwInitiallyReturnsEmptyString()
340 {
341 $this->assertSame('', $this->subject->getWww());
342 }
343
344 /**
345 * @test
346 */
347 public function setWwwSetsWww()
348 {
349 $www = 'foo.bar';
350 $this->subject->setWww($www);
351 $this->assertSame($www, $this->subject->getWww());
352 }
353
354 /**
355 * @test
356 */
357 public function getCompanyInitiallyReturnsEmptyString()
358 {
359 $this->assertSame('', $this->subject->getCompany());
360 }
361
362 /**
363 * @test
364 */
365 public function setCompanySetsCompany()
366 {
367 $company = 'foo bar';
368 $this->subject->setCompany($company);
369 $this->assertSame($company, $this->subject->getCompany());
370 }
371
372 /**
373 * @test
374 */
375 public function getImageInitiallyReturnsEmptyString()
376 {
377 $this->assertSame('', $this->subject->getImage());
378 }
379
380 /**
381 * @test
382 */
383 public function setImageSetsImage()
384 {
385 $image = 'foobar.gif';
386 $this->subject->setImage($image);
387 $this->assertSame($image, $this->subject->getImage());
388 }
389
390 /**
391 * @test
392 */
393 public function getLastloginInitiallyReturnsNull()
394 {
395 $this->assertNull($this->subject->getLastlogin());
396 }
397
398 /**
399 * @test
400 */
401 public function setLastloginSetsLastlogin()
402 {
403 $date = new \DateTime();
404 $this->subject->setLastlogin($date);
405 $this->assertSame($date, $this->subject->getLastlogin());
406 }
407 }