‪TYPO3CMS  10.4
FrontendUserTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
22 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
23 
27 class ‪FrontendUserTest extends UnitTestCase
28 {
32  protected ‪$subject;
33 
34  protected function ‪setUp(): void
35  {
36  parent::setUp();
37  $this->subject = new ‪FrontendUser();
38  }
39 
44  {
45  self::assertSame('', $this->subject->getUsername());
46  }
47 
51  public function ‪setUsernameSetsUsername()
52  {
53  $username = 'don.juan';
54  $this->subject->setUsername($username);
55  self::assertSame($username, $this->subject->getUsername());
56  }
57 
62  {
63  self::assertSame('', $this->subject->getPassword());
64  }
65 
69  public function ‪setPasswordSetsPassword()
70  {
71  $password = 'f00Bar';
72  $this->subject->setPassword($password);
73  self::assertSame($password, $this->subject->getPassword());
74  }
75 
79  public function ‪setUsergroupSetsUsergroup()
80  {
81  $usergroup = new ObjectStorage();
82  $usergroup->attach(new FrontendUserGroup('foo'));
83  $this->subject->setUsergroup($usergroup);
84  self::assertSame($usergroup, $this->subject->getUsergroup());
85  }
86 
90  public function ‪addUsergroupAddsUserGroup()
91  {
92  $usergroup = new FrontendUserGroup('foo');
93  self::assertEquals(count($this->subject->getUsergroup()), 0);
94  $this->subject->addUsergroup($usergroup);
95  self::assertEquals(count($this->subject->getUsergroup()), 1);
96  }
97 
101  public function ‪removeUsergroupRemovesUsergroup()
102  {
103  $usergroup = new FrontendUserGroup('foo');
104  $this->subject->addUsergroup($usergroup);
105  self::assertEquals(count($this->subject->getUsergroup()), 1);
106  $this->subject->removeUsergroup($usergroup);
107  self::assertEquals(count($this->subject->getUsergroup()), 0);
108  }
109 
113  public function ‪getNameInitiallyReturnsEmptyString()
114  {
115  self::assertSame('', $this->subject->getName());
116  }
117 
121  public function ‪setNameSetsName()
122  {
123  $name = 'don juan';
124  $this->subject->setName($name);
125  self::assertSame($name, $this->subject->getName());
126  }
127 
132  {
133  self::assertSame('', $this->subject->getFirstName());
134  }
135 
139  public function ‪setFirstNameSetsFirstName()
140  {
141  $firstName = 'don';
142  $this->subject->setFirstName($firstName);
143  self::assertSame($firstName, $this->subject->getFirstName());
144  }
145 
150  {
151  self::assertSame('', $this->subject->getMiddleName());
152  }
153 
157  public function ‪setMiddleNameSetsMiddleName()
158  {
159  $middleName = 'miguel';
160  $this->subject->setMiddleName($middleName);
161  self::assertSame($middleName, $this->subject->getMiddleName());
162  }
163 
168  {
169  self::assertSame('', $this->subject->getLastName());
170  }
171 
175  public function ‪setLastNameSetsLastName()
176  {
177  $lastName = 'juan';
178  $this->subject->setLastName($lastName);
179  self::assertSame($lastName, $this->subject->getLastName());
180  }
181 
186  {
187  self::assertSame('', $this->subject->getAddress());
188  }
189 
193  public function ‪setAddressSetsAddress()
194  {
195  $address = 'foobar 42, foo';
196  $this->subject->setAddress($address);
197  self::assertSame($address, $this->subject->getAddress());
198  }
199 
204  {
205  self::assertSame('', $this->subject->getTelephone());
206  }
207 
211  public function ‪setTelephoneSetsTelephone()
212  {
213  $telephone = '42';
214  $this->subject->setTelephone($telephone);
215  self::assertSame($telephone, $this->subject->getTelephone());
216  }
217 
221  public function ‪getFaxInitiallyReturnsEmptyString()
222  {
223  self::assertSame('', $this->subject->getFax());
224  }
225 
229  public function ‪setFaxSetsFax()
230  {
231  $fax = '42';
232  $this->subject->setFax($fax);
233  self::assertSame($fax, $this->subject->getFax());
234  }
235 
240  {
241  self::assertSame('', $this->subject->getEmail());
242  }
243 
247  public function ‪setEmailSetsEmail()
248  {
249  $email = 'don.juan@example.com';
250  $this->subject->setEmail($email);
251  self::assertSame($email, $this->subject->getEmail());
252  }
253 
258  {
259  self::assertSame('', $this->subject->getLockToDomain());
260  }
261 
265  public function ‪setLockToDomainSetsLockToDomain()
266  {
267  $lockToDomain = 'foo.bar';
268  $this->subject->setLockToDomain($lockToDomain);
269  self::assertSame($lockToDomain, $this->subject->getLockToDomain());
270  }
271 
276  {
277  self::assertSame('', $this->subject->getTitle());
278  }
279 
283  public function ‪setTitleSetsTitle()
284  {
285  $title = 'foobar';
286  $this->subject->setTitle($title);
287  self::assertSame($title, $this->subject->getTitle());
288  }
289 
293  public function ‪getZipInitiallyReturnsEmptyString()
294  {
295  self::assertSame('', $this->subject->getZip());
296  }
297 
301  public function ‪setZipSetsZip()
302  {
303  $zip = '42';
304  $this->subject->setZip($zip);
305  self::assertSame($zip, $this->subject->getZip());
306  }
307 
311  public function ‪getCityInitiallyReturnsEmptyString()
312  {
313  self::assertSame('', $this->subject->getCity());
314  }
315 
319  public function ‪setCitySetsCity()
320  {
321  $city = 'foo';
322  $this->subject->setCity($city);
323  self::assertSame($city, $this->subject->getCity());
324  }
325 
330  {
331  self::assertSame('', $this->subject->getCountry());
332  }
333 
337  public function ‪setCountrySetsCountry()
338  {
339  $country = 'foo';
340  $this->subject->setCountry($country);
341  self::assertSame($country, $this->subject->getCountry());
342  }
343 
347  public function ‪getWwwInitiallyReturnsEmptyString()
348  {
349  self::assertSame('', $this->subject->getWww());
350  }
351 
355  public function ‪setWwwSetsWww()
356  {
357  $www = 'foo.bar';
358  $this->subject->setWww($www);
359  self::assertSame($www, $this->subject->getWww());
360  }
361 
366  {
367  self::assertSame('', $this->subject->getCompany());
368  }
369 
373  public function ‪setCompanySetsCompany()
374  {
375  $company = 'foo bar';
376  $this->subject->setCompany($company);
377  self::assertSame($company, $this->subject->getCompany());
378  }
379 
384  {
385  self::assertInstanceOf(ObjectStorage::class, $this->subject->getImage());
386  }
387 
391  public function ‪setImageSetsImage()
392  {
393  $images = new ObjectStorage();
394  $reference = new FileReference();
395  $reference->setPid(123);
396  $images->attach($reference);
397 
398  $this->subject->setImage($images);
399  self::assertSame($images, $this->subject->getImage());
400  }
401 
405  public function ‪getLastloginInitiallyReturnsNull()
406  {
407  self::assertNull($this->subject->getLastlogin());
408  }
409 
413  public function ‪setLastloginSetsLastlogin()
414  {
415  $date = new \DateTime();
416  $this->subject->setLastlogin($date);
417  self::assertSame($date, $this->subject->getLastlogin());
418  }
419 }
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setEmailSetsEmail
‪setEmailSetsEmail()
Definition: FrontendUserTest.php:246
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setAddressSetsAddress
‪setAddressSetsAddress()
Definition: FrontendUserTest.php:192
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setPasswordSetsPassword
‪setPasswordSetsPassword()
Definition: FrontendUserTest.php:68
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setUsergroupSetsUsergroup
‪setUsergroupSetsUsergroup()
Definition: FrontendUserTest.php:78
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setZipSetsZip
‪setZipSetsZip()
Definition: FrontendUserTest.php:300
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getCountryInitiallyReturnsEmptyString
‪getCountryInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:328
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setWwwSetsWww
‪setWwwSetsWww()
Definition: FrontendUserTest.php:354
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\removeUsergroupRemovesUsergroup
‪removeUsergroupRemovesUsergroup()
Definition: FrontendUserTest.php:100
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getUsernameInitiallyReturnsEmptyString
‪getUsernameInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:42
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setLockToDomainSetsLockToDomain
‪setLockToDomainSetsLockToDomain()
Definition: FrontendUserTest.php:264
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getPasswordInitiallyReturnsEmptyString
‪getPasswordInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:60
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getMiddleNameInitiallyReturnsEmptyString
‪getMiddleNameInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:148
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getTelephoneInitiallyReturnsEmptyString
‪getTelephoneInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:202
‪TYPO3\CMS\Extbase\Persistence\ObjectStorage
Definition: ObjectStorage.php:28
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getLastNameInitiallyReturnsEmptyString
‪getLastNameInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:166
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getImageInitiallyReturnsObjectStorage
‪getImageInitiallyReturnsObjectStorage()
Definition: FrontendUserTest.php:382
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setLastloginSetsLastlogin
‪setLastloginSetsLastlogin()
Definition: FrontendUserTest.php:412
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getAddressInitiallyReturnsEmptyString
‪getAddressInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:184
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getCompanyInitiallyReturnsEmptyString
‪getCompanyInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:364
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\addUsergroupAddsUserGroup
‪addUsergroupAddsUserGroup()
Definition: FrontendUserTest.php:89
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setMiddleNameSetsMiddleName
‪setMiddleNameSetsMiddleName()
Definition: FrontendUserTest.php:156
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setLastNameSetsLastName
‪setLastNameSetsLastName()
Definition: FrontendUserTest.php:174
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setTelephoneSetsTelephone
‪setTelephoneSetsTelephone()
Definition: FrontendUserTest.php:210
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model
Definition: BackendUserGroupTest.php:16
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setUp
‪setUp()
Definition: FrontendUserTest.php:33
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setCompanySetsCompany
‪setCompanySetsCompany()
Definition: FrontendUserTest.php:372
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setFaxSetsFax
‪setFaxSetsFax()
Definition: FrontendUserTest.php:228
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getCityInitiallyReturnsEmptyString
‪getCityInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:310
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setImageSetsImage
‪setImageSetsImage()
Definition: FrontendUserTest.php:390
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getEmailInitiallyReturnsEmptyString
‪getEmailInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:238
‪TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup
Definition: FrontendUserGroup.php:25
‪TYPO3\CMS\Extbase\Domain\Model\FileReference
Definition: FileReference.php:28
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getTitleInitiallyReturnsEmptyString
‪getTitleInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:274
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setFirstNameSetsFirstName
‪setFirstNameSetsFirstName()
Definition: FrontendUserTest.php:138
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getFaxInitiallyReturnsEmptyString
‪getFaxInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:220
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\$subject
‪TYPO3 CMS Extbase Domain Model FrontendUser $subject
Definition: FrontendUserTest.php:31
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getNameInitiallyReturnsEmptyString
‪getNameInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:112
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getWwwInitiallyReturnsEmptyString
‪getWwwInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:346
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getZipInitiallyReturnsEmptyString
‪getZipInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:292
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getLockToDomainInitiallyReturnsEmptyString
‪getLockToDomainInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:256
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setNameSetsName
‪setNameSetsName()
Definition: FrontendUserTest.php:120
‪TYPO3\CMS\Extbase\Domain\Model\FrontendUser
Definition: FrontendUser.php:25
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setCitySetsCity
‪setCitySetsCity()
Definition: FrontendUserTest.php:318
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getFirstNameInitiallyReturnsEmptyString
‪getFirstNameInitiallyReturnsEmptyString()
Definition: FrontendUserTest.php:130
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest
Definition: FrontendUserTest.php:28
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setTitleSetsTitle
‪setTitleSetsTitle()
Definition: FrontendUserTest.php:282
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setUsernameSetsUsername
‪setUsernameSetsUsername()
Definition: FrontendUserTest.php:50
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\setCountrySetsCountry
‪setCountrySetsCountry()
Definition: FrontendUserTest.php:336
‪TYPO3\CMS\Extbase\Tests\Unit\Domain\Model\FrontendUserTest\getLastloginInitiallyReturnsNull
‪getLastloginInitiallyReturnsNull()
Definition: FrontendUserTest.php:404