[TASK] Shorten the extend class in all unit tests
[Packages/TYPO3.CMS.git] / typo3 / sysext / beuser / Tests / Unit / Domain / Model / BackendUserTest.php
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
17 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
18
19 /**
20 * Test case
21 */
22 class BackendUserTest extends UnitTestCase
23 {
24 /**
25 * @var \TYPO3\CMS\Beuser\Domain\Model\BackendUser
26 */
27 protected $subject;
28
29 protected function setUp()
30 {
31 $this->subject = new \TYPO3\CMS\Beuser\Domain\Model\BackendUser();
32 }
33
34 /**
35 * @test
36 */
37 public function getUidReturnsInitialValueForInt()
38 {
39 $this->assertTrue($this->subject->getUid() === null, 'Not uid set after initialization.');
40 }
41
42 /**
43 * @test
44 */
45 public function getUserNameReturnsInitialValueForString()
46 {
47 $this->assertTrue($this->subject->getUserName() === '', 'Username not empty');
48 }
49
50 /**
51 * @test
52 */
53 public function setUserNameForStringSetsUserName()
54 {
55 $newUserName = 'DonJuan';
56 $this->subject->setUserName($newUserName);
57 $this->assertSame($this->subject->getUserName(), $newUserName);
58 }
59
60 /**
61 * @test
62 */
63 public function getRealNameReturnInitialValueForString()
64 {
65 $this->assertTrue($this->subject->getRealName() === '', 'Real name not empty');
66 }
67
68 /**
69 * @test
70 */
71 public function setRealNameForStringSetsName()
72 {
73 $realName = 'Conceived at T3CON2018';
74 $this->subject->setRealName($realName);
75 $this->assertSame($this->subject->getRealName(), $realName);
76 }
77
78 /**
79 * @test
80 */
81 public function getAdminReturnInitialValueForBoolean()
82 {
83 $this->assertTrue($this->subject->getIsAdministrator() === false, 'Admin status is correct.');
84 }
85
86 /**
87 * @test
88 */
89 public function setAdminToTrueSetsAdmin()
90 {
91 $this->subject->setIsAdministrator(true);
92 $this->assertTrue($this->subject->getIsAdministrator(), 'Admin status is not true, after setting to true.');
93 }
94
95 /**
96 * @test
97 */
98 public function setAdminToFalseSetsAdmin()
99 {
100 $this->subject->setIsAdministrator(false);
101 $this->assertFalse($this->subject->getIsAdministrator(), 'Admin status is not false, after setting to false.');
102 }
103 }