TYPO3 CMS  TYPO3_8-7
FrontendUserTest.php
Go to the documentation of this file.
1 <?php
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  */
18 
22 class FrontendUserTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
23 {
27  protected $subject = null;
28 
29  protected function setUp()
30  {
31  $this->subject = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUser();
32  }
33 
38  {
39  $this->assertSame('', $this->subject->getUsername());
40  }
41 
45  public function setUsernameSetsUsername()
46  {
47  $username = 'don.juan';
48  $this->subject->setUsername($username);
49  $this->assertSame($username, $this->subject->getUsername());
50  }
51 
56  {
57  $this->assertSame('', $this->subject->getPassword());
58  }
59 
63  public function setPasswordSetsPassword()
64  {
65  $password = 'f00Bar';
66  $this->subject->setPassword($password);
67  $this->assertSame($password, $this->subject->getPassword());
68  }
69 
73  public function setUsergroupSetsUsergroup()
74  {
75  $usergroup = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
76  $usergroup->attach(new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup('foo'));
77  $this->subject->setUsergroup($usergroup);
78  $this->assertSame($usergroup, $this->subject->getUsergroup());
79  }
80 
84  public function addUsergroupAddsUserGroup()
85  {
86  $usergroup = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup('foo');
87  $this->assertEquals(count($this->subject->getUsergroup()), 0);
88  $this->subject->addUsergroup($usergroup);
89  $this->assertEquals(count($this->subject->getUsergroup()), 1);
90  }
91 
96  {
97  $usergroup = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup('foo');
98  $this->subject->addUsergroup($usergroup);
99  $this->assertEquals(count($this->subject->getUsergroup()), 1);
100  $this->subject->removeUsergroup($usergroup);
101  $this->assertEquals(count($this->subject->getUsergroup()), 0);
102  }
103 
108  {
109  $this->assertSame('', $this->subject->getName());
110  }
111 
115  public function setNameSetsName()
116  {
117  $name = 'don juan';
118  $this->subject->setName($name);
119  $this->assertSame($name, $this->subject->getName());
120  }
121 
126  {
127  $this->assertSame('', $this->subject->getFirstName());
128  }
129 
133  public function setFirstNameSetsFirstName()
134  {
135  $firstName = 'don';
136  $this->subject->setFirstName($firstName);
137  $this->assertSame($firstName, $this->subject->getFirstName());
138  }
139 
144  {
145  $this->assertSame('', $this->subject->getMiddleName());
146  }
147 
151  public function setMiddleNameSetsMiddleName()
152  {
153  $middleName = 'miguel';
154  $this->subject->setMiddleName($middleName);
155  $this->assertSame($middleName, $this->subject->getMiddleName());
156  }
157 
162  {
163  $this->assertSame('', $this->subject->getLastName());
164  }
165 
169  public function setLastNameSetsLastName()
170  {
171  $lastName = 'juan';
172  $this->subject->setLastName($lastName);
173  $this->assertSame($lastName, $this->subject->getLastName());
174  }
175 
180  {
181  $this->assertSame('', $this->subject->getAddress());
182  }
183 
187  public function setAddressSetsAddress()
188  {
189  $address = 'foobar 42, foo';
190  $this->subject->setAddress($address);
191  $this->assertSame($address, $this->subject->getAddress());
192  }
193 
198  {
199  $this->assertSame('', $this->subject->getTelephone());
200  }
201 
205  public function setTelephoneSetsTelephone()
206  {
207  $telephone = '42';
208  $this->subject->setTelephone($telephone);
209  $this->assertSame($telephone, $this->subject->getTelephone());
210  }
211 
216  {
217  $this->assertSame('', $this->subject->getFax());
218  }
219 
223  public function setFaxSetsFax()
224  {
225  $fax = '42';
226  $this->subject->setFax($fax);
227  $this->assertSame($fax, $this->subject->getFax());
228  }
229 
234  {
235  $this->assertSame('', $this->subject->getEmail());
236  }
237 
241  public function setEmailSetsEmail()
242  {
243  $email = 'don.juan@example.com';
244  $this->subject->setEmail($email);
245  $this->assertSame($email, $this->subject->getEmail());
246  }
247 
252  {
253  $this->assertSame('', $this->subject->getLockToDomain());
254  }
255 
260  {
261  $lockToDomain = 'foo.bar';
262  $this->subject->setLockToDomain($lockToDomain);
263  $this->assertSame($lockToDomain, $this->subject->getLockToDomain());
264  }
265 
270  {
271  $this->assertSame('', $this->subject->getTitle());
272  }
273 
277  public function setTitleSetsTitle()
278  {
279  $title = 'foobar';
280  $this->subject->setTitle($title);
281  $this->assertSame($title, $this->subject->getTitle());
282  }
283 
288  {
289  $this->assertSame('', $this->subject->getZip());
290  }
291 
295  public function setZipSetsZip()
296  {
297  $zip = '42';
298  $this->subject->setZip($zip);
299  $this->assertSame($zip, $this->subject->getZip());
300  }
301 
306  {
307  $this->assertSame('', $this->subject->getCity());
308  }
309 
313  public function setCitySetsCity()
314  {
315  $city = 'foo';
316  $this->subject->setCity($city);
317  $this->assertSame($city, $this->subject->getCity());
318  }
319 
324  {
325  $this->assertSame('', $this->subject->getCountry());
326  }
327 
331  public function setCountrySetsCountry()
332  {
333  $country = 'foo';
334  $this->subject->setCountry($country);
335  $this->assertSame($country, $this->subject->getCountry());
336  }
337 
342  {
343  $this->assertSame('', $this->subject->getWww());
344  }
345 
349  public function setWwwSetsWww()
350  {
351  $www = 'foo.bar';
352  $this->subject->setWww($www);
353  $this->assertSame($www, $this->subject->getWww());
354  }
355 
360  {
361  $this->assertSame('', $this->subject->getCompany());
362  }
363 
367  public function setCompanySetsCompany()
368  {
369  $company = 'foo bar';
370  $this->subject->setCompany($company);
371  $this->assertSame($company, $this->subject->getCompany());
372  }
373 
378  {
379  $this->assertSame(null, $this->subject->getImage());
380  }
381 
385  public function setImageSetsImage()
386  {
387  $images = new ObjectStorage();
388  $reference = new FileReference();
389  $reference->setPid(123);
390  $images->attach($reference);
391 
392  $this->subject->setImage($images);
393  $this->assertSame($images, $this->subject->getImage());
394  }
395 
400  {
401  $this->assertNull($this->subject->getLastlogin());
402  }
403 
407  public function setLastloginSetsLastlogin()
408  {
409  $date = new \DateTime();
410  $this->subject->setLastlogin($date);
411  $this->assertSame($date, $this->subject->getLastlogin());
412  }
413 }