TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
FrontendUserTest.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\FrontendUser();
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->assertSame('', $this->subject->getPassword());
56  }
57 
61  public function setPasswordSetsPassword()
62  {
63  $password = 'f00Bar';
64  $this->subject->setPassword($password);
65  $this->assertSame($password, $this->subject->getPassword());
66  }
67 
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 
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 
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 
106  {
107  $this->assertSame('', $this->subject->getName());
108  }
109 
113  public function setNameSetsName()
114  {
115  $name = 'don juan';
116  $this->subject->setName($name);
117  $this->assertSame($name, $this->subject->getName());
118  }
119 
124  {
125  $this->assertSame('', $this->subject->getFirstName());
126  }
127 
131  public function setFirstNameSetsFirstName()
132  {
133  $firstName = 'don';
134  $this->subject->setFirstName($firstName);
135  $this->assertSame($firstName, $this->subject->getFirstName());
136  }
137 
142  {
143  $this->assertSame('', $this->subject->getMiddleName());
144  }
145 
149  public function setMiddleNameSetsMiddleName()
150  {
151  $middleName = 'miguel';
152  $this->subject->setMiddleName($middleName);
153  $this->assertSame($middleName, $this->subject->getMiddleName());
154  }
155 
160  {
161  $this->assertSame('', $this->subject->getLastName());
162  }
163 
167  public function setLastNameSetsLastName()
168  {
169  $lastName = 'juan';
170  $this->subject->setLastName($lastName);
171  $this->assertSame($lastName, $this->subject->getLastName());
172  }
173 
178  {
179  $this->assertSame('', $this->subject->getAddress());
180  }
181 
185  public function setAddressSetsAddress()
186  {
187  $address = 'foobar 42, foo';
188  $this->subject->setAddress($address);
189  $this->assertSame($address, $this->subject->getAddress());
190  }
191 
196  {
197  $this->assertSame('', $this->subject->getTelephone());
198  }
199 
203  public function setTelephoneSetsTelephone()
204  {
205  $telephone = '42';
206  $this->subject->setTelephone($telephone);
207  $this->assertSame($telephone, $this->subject->getTelephone());
208  }
209 
214  {
215  $this->assertSame('', $this->subject->getFax());
216  }
217 
221  public function setFaxSetsFax()
222  {
223  $fax = '42';
224  $this->subject->setFax($fax);
225  $this->assertSame($fax, $this->subject->getFax());
226  }
227 
232  {
233  $this->assertSame('', $this->subject->getEmail());
234  }
235 
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 
250  {
251  $this->assertSame('', $this->subject->getLockToDomain());
252  }
253 
258  {
259  $lockToDomain = 'foo.bar';
260  $this->subject->setLockToDomain($lockToDomain);
261  $this->assertSame($lockToDomain, $this->subject->getLockToDomain());
262  }
263 
268  {
269  $this->assertSame('', $this->subject->getTitle());
270  }
271 
275  public function setTitleSetsTitle()
276  {
277  $title = 'foobar';
278  $this->subject->setTitle($title);
279  $this->assertSame($title, $this->subject->getTitle());
280  }
281 
286  {
287  $this->assertSame('', $this->subject->getZip());
288  }
289 
293  public function setZipSetsZip()
294  {
295  $zip = '42';
296  $this->subject->setZip($zip);
297  $this->assertSame($zip, $this->subject->getZip());
298  }
299 
304  {
305  $this->assertSame('', $this->subject->getCity());
306  }
307 
311  public function setCitySetsCity()
312  {
313  $city = 'foo';
314  $this->subject->setCity($city);
315  $this->assertSame($city, $this->subject->getCity());
316  }
317 
322  {
323  $this->assertSame('', $this->subject->getCountry());
324  }
325 
329  public function setCountrySetsCountry()
330  {
331  $country = 'foo';
332  $this->subject->setCountry($country);
333  $this->assertSame($country, $this->subject->getCountry());
334  }
335 
340  {
341  $this->assertSame('', $this->subject->getWww());
342  }
343 
347  public function setWwwSetsWww()
348  {
349  $www = 'foo.bar';
350  $this->subject->setWww($www);
351  $this->assertSame($www, $this->subject->getWww());
352  }
353 
358  {
359  $this->assertSame('', $this->subject->getCompany());
360  }
361 
365  public function setCompanySetsCompany()
366  {
367  $company = 'foo bar';
368  $this->subject->setCompany($company);
369  $this->assertSame($company, $this->subject->getCompany());
370  }
371 
376  {
377  $this->assertSame('', $this->subject->getImage());
378  }
379 
383  public function setImageSetsImage()
384  {
385  $image = 'foobar.gif';
386  $this->subject->setImage($image);
387  $this->assertSame($image, $this->subject->getImage());
388  }
389 
394  {
395  $this->assertNull($this->subject->getLastlogin());
396  }
397 
401  public function setLastloginSetsLastlogin()
402  {
403  $date = new \DateTime();
404  $this->subject->setLastlogin($date);
405  $this->assertSame($date, $this->subject->getLastlogin());
406  }
407 }