‪TYPO3CMS  9.5
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 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
19 
23 class ‪FrontendUserTest extends UnitTestCase
24 {
28  protected ‪$subject;
29 
30  protected function ‪setUp()
31  {
32  $this->subject = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUser();
33  }
34 
39  {
40  $this->assertSame('', $this->subject->getUsername());
41  }
42 
46  public function ‪setUsernameSetsUsername()
47  {
48  $username = 'don.juan';
49  $this->subject->setUsername($username);
50  $this->assertSame($username, $this->subject->getUsername());
51  }
52 
57  {
58  $this->assertSame('', $this->subject->getPassword());
59  }
60 
64  public function ‪setPasswordSetsPassword()
65  {
66  $password = 'f00Bar';
67  $this->subject->setPassword($password);
68  $this->assertSame($password, $this->subject->getPassword());
69  }
70 
74  public function ‪setUsergroupSetsUsergroup()
75  {
76  $usergroup = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
77  $usergroup->attach(new \‪TYPO3\CMS\‪Extbase\Domain\Model\FrontendUserGroup('foo'));
78  $this->subject->setUsergroup($usergroup);
79  $this->assertSame($usergroup, $this->subject->getUsergroup());
80  }
81 
85  public function ‪addUsergroupAddsUserGroup()
86  {
87  $usergroup = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup('foo');
88  $this->assertEquals(count($this->subject->getUsergroup()), 0);
89  $this->subject->addUsergroup($usergroup);
90  $this->assertEquals(count($this->subject->getUsergroup()), 1);
91  }
92 
96  public function ‪removeUsergroupRemovesUsergroup()
97  {
98  $usergroup = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup('foo');
99  $this->subject->addUsergroup($usergroup);
100  $this->assertEquals(count($this->subject->getUsergroup()), 1);
101  $this->subject->removeUsergroup($usergroup);
102  $this->assertEquals(count($this->subject->getUsergroup()), 0);
103  }
104 
108  public function ‪getNameInitiallyReturnsEmptyString()
109  {
110  $this->assertSame('', $this->subject->getName());
111  }
112 
116  public function ‪setNameSetsName()
117  {
118  $name = 'don juan';
119  $this->subject->setName($name);
120  $this->assertSame($name, $this->subject->getName());
121  }
122 
127  {
128  $this->assertSame('', $this->subject->getFirstName());
129  }
130 
134  public function ‪setFirstNameSetsFirstName()
135  {
136  $firstName = 'don';
137  $this->subject->setFirstName($firstName);
138  $this->assertSame($firstName, $this->subject->getFirstName());
139  }
140 
145  {
146  $this->assertSame('', $this->subject->getMiddleName());
147  }
148 
152  public function ‪setMiddleNameSetsMiddleName()
153  {
154  $middleName = 'miguel';
155  $this->subject->setMiddleName($middleName);
156  $this->assertSame($middleName, $this->subject->getMiddleName());
157  }
158 
163  {
164  $this->assertSame('', $this->subject->getLastName());
165  }
166 
170  public function ‪setLastNameSetsLastName()
171  {
172  $lastName = 'juan';
173  $this->subject->setLastName($lastName);
174  $this->assertSame($lastName, $this->subject->getLastName());
175  }
176 
181  {
182  $this->assertSame('', $this->subject->getAddress());
183  }
184 
188  public function ‪setAddressSetsAddress()
189  {
190  $address = 'foobar 42, foo';
191  $this->subject->setAddress($address);
192  $this->assertSame($address, $this->subject->getAddress());
193  }
194 
199  {
200  $this->assertSame('', $this->subject->getTelephone());
201  }
202 
206  public function ‪setTelephoneSetsTelephone()
207  {
208  $telephone = '42';
209  $this->subject->setTelephone($telephone);
210  $this->assertSame($telephone, $this->subject->getTelephone());
211  }
212 
216  public function ‪getFaxInitiallyReturnsEmptyString()
217  {
218  $this->assertSame('', $this->subject->getFax());
219  }
220 
224  public function ‪setFaxSetsFax()
225  {
226  $fax = '42';
227  $this->subject->setFax($fax);
228  $this->assertSame($fax, $this->subject->getFax());
229  }
230 
235  {
236  $this->assertSame('', $this->subject->getEmail());
237  }
238 
242  public function ‪setEmailSetsEmail()
243  {
244  $email = 'don.juan@example.com';
245  $this->subject->setEmail($email);
246  $this->assertSame($email, $this->subject->getEmail());
247  }
248 
253  {
254  $this->assertSame('', $this->subject->getLockToDomain());
255  }
256 
260  public function ‪setLockToDomainSetsLockToDomain()
261  {
262  $lockToDomain = 'foo.bar';
263  $this->subject->setLockToDomain($lockToDomain);
264  $this->assertSame($lockToDomain, $this->subject->getLockToDomain());
265  }
266 
271  {
272  $this->assertSame('', $this->subject->getTitle());
273  }
274 
278  public function ‪setTitleSetsTitle()
279  {
280  $title = 'foobar';
281  $this->subject->setTitle($title);
282  $this->assertSame($title, $this->subject->getTitle());
283  }
284 
288  public function ‪getZipInitiallyReturnsEmptyString()
289  {
290  $this->assertSame('', $this->subject->getZip());
291  }
292 
296  public function ‪setZipSetsZip()
297  {
298  $zip = '42';
299  $this->subject->setZip($zip);
300  $this->assertSame($zip, $this->subject->getZip());
301  }
302 
306  public function ‪getCityInitiallyReturnsEmptyString()
307  {
308  $this->assertSame('', $this->subject->getCity());
309  }
310 
314  public function ‪setCitySetsCity()
315  {
316  $city = 'foo';
317  $this->subject->setCity($city);
318  $this->assertSame($city, $this->subject->getCity());
319  }
320 
325  {
326  $this->assertSame('', $this->subject->getCountry());
327  }
328 
332  public function ‪setCountrySetsCountry()
333  {
334  $country = 'foo';
335  $this->subject->setCountry($country);
336  $this->assertSame($country, $this->subject->getCountry());
337  }
338 
342  public function ‪getWwwInitiallyReturnsEmptyString()
343  {
344  $this->assertSame('', $this->subject->getWww());
345  }
346 
350  public function ‪setWwwSetsWww()
351  {
352  $www = 'foo.bar';
353  $this->subject->setWww($www);
354  $this->assertSame($www, $this->subject->getWww());
355  }
356 
361  {
362  $this->assertSame('', $this->subject->getCompany());
363  }
364 
368  public function ‪setCompanySetsCompany()
369  {
370  $company = 'foo bar';
371  $this->subject->setCompany($company);
372  $this->assertSame($company, $this->subject->getCompany());
373  }
374 
379  {
380  $this->assertInstanceOf(\‪TYPO3\CMS\‪Extbase\Persistence\ObjectStorage::class, $this->subject->getImage());
381  }
382 
386  public function ‪setImageSetsImage()
387  {
388  $images = new ObjectStorage();
389  $reference = new FileReference();
390  $reference->setPid(123);
391  $images->attach($reference);
392 
393  $this->subject->setImage($images);
394  $this->assertSame($images, $this->subject->getImage());
395  }
396 
400  public function ‪getLastloginInitiallyReturnsNull()
401  {
402  $this->assertNull($this->subject->getLastlogin());
403  }
404 
408  public function ‪setLastloginSetsLastlogin()
409  {
410  $date = new \DateTime();
411  $this->subject->setLastlogin($date);
412  $this->assertSame($date, $this->subject->getLastlogin());
413  }
414 }
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setEmailSetsEmail
‪setEmailSetsEmail()
Definition: FrontendUserTest.php:241
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setAddressSetsAddress
‪setAddressSetsAddress()
Definition: FrontendUserTest.php:187
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setPasswordSetsPassword
‪setPasswordSetsPassword()
Definition: FrontendUserTest.php:63
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setUsergroupSetsUsergroup
‪setUsergroupSetsUsergroup()
Definition: FrontendUserTest.php:73
‪TYPO3\CMS\Extbase\Annotation
Definition: IgnoreValidation.php:4
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setZipSetsZip
‪setZipSetsZip()
Definition: FrontendUserTest.php:295
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getCountryInitiallyReturnsEmptyString
‪getCountryInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:323
‪TYPO3
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setWwwSetsWww
‪setWwwSetsWww()
Definition: FrontendUserTest.php:349
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\removeUsergroupRemovesUsergroup
‪removeUsergroupRemovesUsergroup()
Definition: FrontendUserTest.php:95
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getUsernameInitiallyReturnsEmptyString
‪getUsernameInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:37
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setLockToDomainSetsLockToDomain
‪setLockToDomainSetsLockToDomain()
Definition: FrontendUserTest.php:259
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getPasswordInitiallyReturnsEmptyString
‪getPasswordInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:55
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getMiddleNameInitiallyReturnsEmptyString
‪getMiddleNameInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:143
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getTelephoneInitiallyReturnsEmptyString
‪getTelephoneInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:197
‪TYPO3\CMS\Extbase\Persistence\ObjectStorage
Definition: ObjectStorage.php:26
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getLastNameInitiallyReturnsEmptyString
‪getLastNameInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:161
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getImageInitiallyReturnsObjectStorage
‪getImageInitiallyReturnsObjectStorage()
Definition: FrontendUserTest.php:377
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setLastloginSetsLastlogin
‪setLastloginSetsLastlogin()
Definition: FrontendUserTest.php:407
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getAddressInitiallyReturnsEmptyString
‪getAddressInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:179
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getCompanyInitiallyReturnsEmptyString
‪getCompanyInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:359
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\addUsergroupAddsUserGroup
‪addUsergroupAddsUserGroup()
Definition: FrontendUserTest.php:84
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setMiddleNameSetsMiddleName
‪setMiddleNameSetsMiddleName()
Definition: FrontendUserTest.php:151
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setLastNameSetsLastName
‪setLastNameSetsLastName()
Definition: FrontendUserTest.php:169
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setTelephoneSetsTelephone
‪setTelephoneSetsTelephone()
Definition: FrontendUserTest.php:205
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model
Definition: BackendUserGroupTest.php:2
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setUp
‪setUp()
Definition: FrontendUserTest.php:29
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setCompanySetsCompany
‪setCompanySetsCompany()
Definition: FrontendUserTest.php:367
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setFaxSetsFax
‪setFaxSetsFax()
Definition: FrontendUserTest.php:223
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getCityInitiallyReturnsEmptyString
‪getCityInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:305
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setImageSetsImage
‪setImageSetsImage()
Definition: FrontendUserTest.php:385
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getEmailInitiallyReturnsEmptyString
‪getEmailInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:233
‪TYPO3\CMS\Extbase\Domain\Model\FileReference
Definition: FileReference.php:25
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getTitleInitiallyReturnsEmptyString
‪getTitleInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:269
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setFirstNameSetsFirstName
‪setFirstNameSetsFirstName()
Definition: FrontendUserTest.php:133
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getFaxInitiallyReturnsEmptyString
‪getFaxInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:215
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\$subject
‪TYPO3 CMS Extbase Domain Model FrontendUser $subject
Definition: FrontendUserTest.php:27
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getNameInitiallyReturnsEmptyString
‪getNameInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:107
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getWwwInitiallyReturnsEmptyString
‪getWwwInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:341
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getZipInitiallyReturnsEmptyString
‪getZipInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:287
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getLockToDomainInitiallyReturnsEmptyString
‪getLockToDomainInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:251
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setNameSetsName
‪setNameSetsName()
Definition: FrontendUserTest.php:115
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setCitySetsCity
‪setCitySetsCity()
Definition: FrontendUserTest.php:313
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getFirstNameInitiallyReturnsEmptyString
‪getFirstNameInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:125
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest
Definition: FrontendUserTest.php:24
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setTitleSetsTitle
‪setTitleSetsTitle()
Definition: FrontendUserTest.php:277
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setUsernameSetsUsername
‪setUsernameSetsUsername()
Definition: FrontendUserTest.php:45
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setCountrySetsCountry
‪setCountrySetsCountry()
Definition: FrontendUserTest.php:331
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getLastloginInitiallyReturnsNull
‪getLastloginInitiallyReturnsNull()
Definition: FrontendUserTest.php:399