◆ setUp()
| ilServicesGlobalScreenTest::setUp |
( |
| ) |
|
|
protected |
◆ tearDown()
| ilServicesGlobalScreenTest::tearDown |
( |
| ) |
|
|
protected |
◆ testAdminAccessFalse()
| ilServicesGlobalScreenTest::testAdminAccessFalse |
( |
| ) |
|
Definition at line 77 of file ilServicesGlobalScreenTest.php.
77 : void
78 {
80 $DIC[
'rbacsystem'] = $rbac_mock = $this->createMock(ilRbacSystem::class);
82
83 $rbac_mock->expects($this->once())
84 ->method('checkAccess')
86 ->willReturn(false);
87
88 $this->assertFalse($class->hasAdministrationAccess()());
89 $this->assertFalse(
90 $class->hasAdministrationAccess()()
91 );
92 }
Class BasicAccessCheckClosures.
References $DIC, and SYSTEM_FOLDER_ID.
◆ testAdminAccessTrue()
| ilServicesGlobalScreenTest::testAdminAccessTrue |
( |
| ) |
|
Definition at line 60 of file ilServicesGlobalScreenTest.php.
60 : void
61 {
63 $DIC[
'rbacsystem'] = $rbac_mock = $this->createMock(ilRbacSystem::class);
65
66 $rbac_mock->expects($this->once())
67 ->method('checkAccess')
69 ->willReturn(true);
70
71 $this->assertTrue($class->hasAdministrationAccess()());
72 $this->assertTrue(
73 $class->hasAdministrationAccess()()
74 );
75 }
References $DIC, and SYSTEM_FOLDER_ID.
◆ testAdminAcessTrueButWithClosure()
| ilServicesGlobalScreenTest::testAdminAcessTrueButWithClosure |
( |
| ) |
|
Definition at line 94 of file ilServicesGlobalScreenTest.php.
94 : void
95 {
97 $DIC[
'rbacsystem'] = $rbac_mock = $this->createMock(ilRbacSystem::class);
99
100 $rbac_mock->expects($this->once())
101 ->method('checkAccess')
103 ->willReturn(true);
104
105 $closure_returning_false = function (): bool {
106 return false;
107 };
108
109 $this->assertTrue($class->hasAdministrationAccess()());
110 $this->assertFalse(
111 $class->hasAdministrationAccess($closure_returning_false)()
112 );
113 }
References $DIC, and SYSTEM_FOLDER_ID.
◆ testRepoAccessFalseLoggedIn()
| ilServicesGlobalScreenTest::testRepoAccessFalseLoggedIn |
( |
| ) |
|
Definition at line 235 of file ilServicesGlobalScreenTest.php.
235 : void
236 {
238
239 $DIC[
'ilUser'] =
$user_mock = $this->createMock(ilObjUser::class);
240 $DIC[
'ilSetting'] = $settings_mock = $this->createMock(ilSetting::class);
241 $DIC[
'ilAccess'] = $access_mock = $this->createMock(ilAccessHandler::class);
242
244
246 ->method('isAnonymous')
247 ->willReturn(false);
248
250 ->method('getId')
251 ->willReturn(6);
252
253 $settings_mock->expects($this->never())
254 ->method('get');
255
256 $access_mock->expects($this->once())
257 ->method('checkAccess')
259 ->willReturn(false);
260
261 $this->assertFalse($class->isRepositoryReadable()());
262 $this->assertFalse(
263 $class->isRepositoryReadable()()
264 );
265 $this->assertFalse(
266 $class->isRepositoryReadable(
function ():
bool {
267 return true;
268 })()
269 );
270 $this->assertFalse(
271 $class->isRepositoryReadable(
function ():
bool {
272 return false;
273 })()
274 );
275 }
static return function(ContainerConfigurator $containerConfigurator)
References $DIC, $user_mock, function, and ROOT_FOLDER_ID.
◆ testRepoAccessTrueLoggedIn()
| ilServicesGlobalScreenTest::testRepoAccessTrueLoggedIn |
( |
| ) |
|
Definition at line 193 of file ilServicesGlobalScreenTest.php.
193 : void
194 {
196
197 $DIC[
'ilUser'] =
$user_mock = $this->createMock(ilObjUser::class);
198 $DIC[
'ilSetting'] = $settings_mock = $this->createMock(ilSetting::class);
199 $DIC[
'ilAccess'] = $access_mock = $this->createMock(ilAccessHandler::class);
200
202
204 ->method('isAnonymous')
205 ->willReturn(false);
206
208 ->method('getId')
209 ->willReturn(6);
210
211 $settings_mock->expects($this->never())
212 ->method('get');
213
214 $access_mock->expects($this->once())
215 ->method('checkAccess')
217 ->willReturn(true);
218
219 $this->assertTrue($class->isRepositoryReadable()());
220 $this->assertTrue(
221 $class->isRepositoryReadable()()
222 );
223 $this->assertTrue(
224 $class->isRepositoryReadable(
function ():
bool {
225 return true;
226 })()
227 );
228 $this->assertFalse(
229 $class->isRepositoryReadable(
function ():
bool {
230 return false;
231 })()
232 );
233 }
References $DIC, $user_mock, function, and ROOT_FOLDER_ID.
◆ testRepoAccessTrueNotLoggedInNoPublicSection()
| ilServicesGlobalScreenTest::testRepoAccessTrueNotLoggedInNoPublicSection |
( |
| ) |
|
Definition at line 155 of file ilServicesGlobalScreenTest.php.
155 : void
156 {
158
159 $DIC[
'ilUser'] =
$user_mock = $this->createMock(ilObjUser::class);
160 $DIC[
'ilSetting'] = $settings_mock = $this->createMock(ilSetting::class);
161 $DIC[
'ilAccess'] = $access_mock = $this->createMock(ilAccessHandler::class);
162
164
166 ->method('isAnonymous')
167 ->willReturn(true);
168
169 $settings_mock->expects($this->once())
170 ->method('get')
171 ->with('pub_section')
172 ->willReturn('0');
173
174 $access_mock->expects($this->never())
175 ->method('checkAccessOfUser');
176
177 $this->assertFalse($class->isRepositoryReadable()());
178 $this->assertFalse(
179 $class->isRepositoryReadable()()
180 );
181 $this->assertFalse(
182 $class->isRepositoryReadable(
function ():
bool {
183 return true;
184 })()
185 );
186 $this->assertFalse(
187 $class->isRepositoryReadable(
function ():
bool {
188 return false;
189 })()
190 );
191 }
References $DIC, $user_mock, and function.
◆ testRepoAccessTrueNotLoggedInPublicSection()
| ilServicesGlobalScreenTest::testRepoAccessTrueNotLoggedInPublicSection |
( |
| ) |
|
Definition at line 115 of file ilServicesGlobalScreenTest.php.
115 : void
116 {
118
119 $DIC[
'ilUser'] =
$user_mock = $this->createMock(ilObjUser::class);
120 $DIC[
'ilSetting'] = $settings_mock = $this->createMock(ilSetting::class);
121 $DIC[
'ilAccess'] = $access_mock = $this->createMock(ilAccessHandler::class);
122
124
126 ->method('isAnonymous')
127 ->willReturn(true);
128
129 $settings_mock->expects($this->once())
130 ->method('get')
131 ->with('pub_section')
132 ->willReturn('1');
133
134 $access_mock->expects($this->once())
135 ->method('checkAccessOfUser')
136 ->with($this->isType(
'integer'),
'read',
'', $this->
ROOT_FOLDER_ID)
137 ->willReturn(true);
138
139 $this->assertTrue($class->isRepositoryReadable()());
140 $this->assertTrue(
141 $class->isRepositoryReadable()()
142 );
143 $this->assertTrue(
144 $class->isRepositoryReadable(
function ():
bool {
145 return true;
146 })()
147 );
148 $this->assertFalse(
149 $class->isRepositoryReadable(
function ():
bool {
150 return false;
151 })()
152 );
153 }
References $DIC, $user_mock, function, and ROOT_FOLDER_ID.
◆ $dic_backup
| Container ilServicesGlobalScreenTest::$dic_backup = null |
|
private |
◆ $rbacsystem_mock
◆ $ROOT_FOLDER_ID
| int ilServicesGlobalScreenTest::$ROOT_FOLDER_ID |
|
private |
◆ $SYSTEM_FOLDER_ID
| int ilServicesGlobalScreenTest::$SYSTEM_FOLDER_ID |
|
private |
◆ $user_mock
| ilObjUser ilServicesGlobalScreenTest::$user_mock |
|
private |
The documentation for this class was generated from the following file: