bf163750dbf66a28678eebf736045707400ce519
[Packages/TYPO3.CMS.git] / typo3 / sysext / beuser / Tests / Unit / Domain / Model / DemandTest.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 /**
18 * Test case for class \TYPO3\CMS\Beuser\Domain\Model\Demand
19 */
20 class DemandTest extends \TYPO3\Components\TestingFramework\Core\UnitTestCase
21 {
22 /**
23 * @var \TYPO3\CMS\Beuser\Domain\Model\Demand
24 */
25 protected $subject;
26
27 protected function setUp()
28 {
29 $this->subject = new \TYPO3\CMS\Beuser\Domain\Model\Demand();
30 }
31
32 /**
33 * @test
34 */
35 public function setUserTypeAllExpectedValueForInt()
36 {
37 $userType = \TYPO3\CMS\Beuser\Domain\Model\Demand::ALL;
38 $this->subject->setUserType($userType);
39 $this->assertSame($this->subject->getUserType(), $userType);
40 }
41
42 /**
43 * @test
44 */
45 public function setUserTypeAdminOnlyExpectedValueForInt()
46 {
47 $userType = \TYPO3\CMS\Beuser\Domain\Model\Demand::USERTYPE_ADMINONLY;
48 $this->subject->setUserType($userType);
49 $this->assertSame($this->subject->getUserType(), $userType);
50 }
51
52 /**
53 * @test
54 */
55 public function setUserTypeUserOnlyExpectedValueForInt()
56 {
57 $userType = \TYPO3\CMS\Beuser\Domain\Model\Demand::USERTYPE_USERONLY;
58 $this->subject->setUserType($userType);
59 $this->assertSame($this->subject->getUserType(), $userType);
60 }
61
62 /**
63 * @test
64 */
65 public function setStatusAllExpectedValueForInt()
66 {
67 $status = \TYPO3\CMS\Beuser\Domain\Model\Demand::ALL;
68 $this->subject->setStatus($status);
69 $this->assertSame($this->subject->getStatus(), $status);
70 }
71
72 /**
73 * @test
74 */
75 public function setStatusActiveExpectedValueForInt()
76 {
77 $status = \TYPO3\CMS\Beuser\Domain\Model\Demand::STATUS_ACTIVE;
78 $this->subject->setStatus($status);
79 $this->assertSame($this->subject->getStatus(), $status);
80 }
81
82 /**
83 * @test
84 */
85 public function setStatusInactiveExpectedValueForInt()
86 {
87 $status = \TYPO3\CMS\Beuser\Domain\Model\Demand::STATUS_INACTIVE;
88 $this->subject->setStatus($status);
89 $this->assertSame($this->subject->getStatus(), $status);
90 }
91
92 /**
93 * @test
94 */
95 public function setLoginAllExpectedValueForInt()
96 {
97 $login = \TYPO3\CMS\Beuser\Domain\Model\Demand::ALL;
98 $this->subject->setLogins($login);
99 $this->assertSame($this->subject->getLogins(), $login);
100 }
101
102 /**
103 * @test
104 */
105 public function setLoginNoneExpectedValueForInt()
106 {
107 $login = \TYPO3\CMS\Beuser\Domain\Model\Demand::LOGIN_NONE;
108 $this->subject->setLogins($login);
109 $this->assertSame($this->subject->getLogins(), $login);
110 }
111
112 /**
113 * @test
114 */
115 public function setLoginxSameExpectedValueForInt()
116 {
117 $login = \TYPO3\CMS\Beuser\Domain\Model\Demand::LOGIN_SOME;
118 $this->subject->setLogins($login);
119 $this->assertSame($this->subject->getLogins(), $login);
120 }
121
122 /**
123 * @test
124 */
125 public function getUserNameInitialValueForString()
126 {
127 $this->assertSame($this->subject->getUserName(), '', 'UserName must be empty string.');
128 }
129
130 /**
131 * @test
132 */
133 public function setUserNameReturnExpectedValueForString()
134 {
135 $newUserName = 'User#รครค*%^name';
136 $this->subject->setUserName($newUserName);
137 $this->assertSame($this->subject->getUserName(), $newUserName, 'UserName is not as set before.');
138 }
139 }