TYPO3  7.6
BackendUserTest.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Beuser\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 
20 class BackendUserTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
21 {
25  protected $subject;
26 
27  protected function setUp()
28  {
29  $this->subject = new \TYPO3\CMS\Beuser\Domain\Model\BackendUser();
30  }
31 
36  {
37  $this->assertTrue($this->subject->getUid() === null, 'Not uid set after initialization.');
38  }
39 
44  {
45  $this->assertTrue($this->subject->getUserName() === '', 'Username not empty');
46  }
47 
52  {
53  $newUserName = 'DonJuan';
54  $this->subject->setUserName($newUserName);
55  $this->assertSame($this->subject->getUserName(), $newUserName);
56  }
57 
62  {
63  $this->assertTrue($this->subject->getRealName() === '', 'Real name not empty');
64  }
65 
69  public function setRealNameForStringSetsName()
70  {
71  $realName = 'Conceived at T3CON2018';
72  $this->subject->setRealName($realName);
73  $this->assertSame($this->subject->getRealName(), $realName);
74  }
75 
80  {
81  $this->assertTrue($this->subject->getIsAdministrator() === false, 'Admin status is correct.');
82  }
83 
87  public function setAdminToTrueSetsAdmin()
88  {
89  $this->subject->setIsAdministrator(true);
90  $this->assertTrue($this->subject->getIsAdministrator(), 'Admin status is not true, after setting to true.');
91  }
92 
96  public function setAdminToFalseSetsAdmin()
97  {
98  $this->subject->setIsAdministrator(false);
99  $this->assertFalse($this->subject->getIsAdministrator(), 'Admin status is not false, after setting to false.');
100  }
101 }