Class ilObjChatroomAccessTest.
More...
◆ setUp()
ilObjChatroomAccessTest::setUp |
( |
| ) |
|
|
protected |
◆ testAccessChecksFail()
ilObjChatroomAccessTest::testAccessChecksFail |
( |
| ) |
|
Definition at line 149 of file ilObjChatroomAccessTest.php.
References $objId, $refId, ILIAS\Repository\access(), and ilChatroomAbstractTestBase\setGlobalVariable().
155 $user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->onlyMethods(
158 $user->expects($this->once())->method(
'getId')->willReturn($userId);
162 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->onlyMethods(
163 [
'checkAccessOfUser']
165 $rbacsystem->expects($this->once())->method(
'checkAccessOfUser')->with(
166 $this->equalTo($userId),
167 $this->equalTo(
'write'),
169 )->willReturn(
false);
setGlobalVariable(string $name, $value)
◆ testAccessChecksSucceed()
ilObjChatroomAccessTest::testAccessChecksSucceed |
( |
| ) |
|
Definition at line 176 of file ilObjChatroomAccessTest.php.
References $objId, $refId, ILIAS\Repository\access(), null, and ilChatroomAbstractTestBase\setGlobalVariable().
182 $user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->onlyMethods(
185 $user->expects($this->once())->method(
'getId')->willReturn($userId);
189 $this->db->method(
'fetchAssoc')->willReturnOnConsecutiveCalls(
190 [
'keyword' =>
'chat_enabled',
'value' =>
'0'],
194 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->onlyMethods(
195 [
'checkAccessOfUser']
197 $rbacsystem->expects($this->once())->method(
'checkAccessOfUser')->with(
198 $this->equalTo($userId),
199 $this->equalTo(
'write'),
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setGlobalVariable(string $name, $value)
◆ testCommandDefitionFullfilsExpectations()
ilObjChatroomAccessTest::testCommandDefitionFullfilsExpectations |
( |
| ) |
|
Definition at line 32 of file ilObjChatroomAccessTest.php.
35 [
'permission' =>
'read',
'cmd' =>
'view',
'lang_var' =>
'enter',
'default' =>
true],
36 [
'permission' =>
'write',
'cmd' =>
'settings-general',
'lang_var' =>
'settings'],
39 $commands = $this->access::_getCommands();
41 $this->assertIsArray($commands);
42 $this->assertSame($expected, $commands);
◆ testGotoCheckFails()
ilObjChatroomAccessTest::testGotoCheckFails |
( |
| ) |
|
Definition at line 45 of file ilObjChatroomAccessTest.php.
References ilDBStatement\fetchAssoc(), null, and ilChatroomAbstractTestBase\setGlobalVariable().
47 $user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->onlyMethods(
50 $user->method(
'getId')->willReturn(6);
52 $this->
setGlobalVariable(
'ilObjDataCache', $this->createMock(ilObjectDataCache::class));
56 $chatroomSettings = $this->createMock(ilDBStatement::class);
58 ->method(
'fetchAssoc')
59 ->willReturnOnConsecutiveCalls(
61 'keyword' =>
'public_room_ref',
68 ->method(
'fetchAssoc')
73 ->with($this->stringContains(
"FROM settings WHERE module='chatroom'",
false))
74 ->willReturn($chatroomSettings);
77 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->onlyMethods(
78 [
'checkAccess',
'checkAccessOfUser']
80 $rbacsystem->method(
'checkAccess')->with(
81 $this->logicalOr($this->equalTo(
'read'), $this->equalTo(
'visible')),
84 $rbacsystem->method(
'checkAccessOfUser')->with(
86 $this->logicalOr($this->equalTo(
'read'), $this->equalTo(
'visible')),
92 $this->assertFalse($this->access::_checkGoto(
''));
93 $this->assertFalse($this->access::_checkGoto(
'chtr'));
94 $this->assertFalse($this->access::_checkGoto(
'chtr_'));
95 $this->assertFalse($this->access::_checkGoto(
'chtr_'));
96 $this->assertFalse($this->access::_checkGoto(
'chtr_test'));
97 $this->assertFalse($this->access::_checkGoto(
'chtr_1'));
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setGlobalVariable(string $name, $value)
◆ testGotoCheckSucceeds()
ilObjChatroomAccessTest::testGotoCheckSucceeds |
( |
| ) |
|
Definition at line 100 of file ilObjChatroomAccessTest.php.
References ilDBStatement\fetchAssoc(), null, and ilChatroomAbstractTestBase\setGlobalVariable().
102 $user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->onlyMethods(
105 $user->method(
'getId')->willReturn(6);
107 $this->
setGlobalVariable(
'ilObjDataCache', $this->createMock(ilObjectDataCache::class));
110 $chatroomSettings = $this->createMock(ilDBStatement::class);
112 ->method(
'fetchAssoc')
113 ->willReturnOnConsecutiveCalls(
115 'keyword' =>
'public_room_ref',
122 ->method(
'fetchAssoc')
127 ->with($this->stringContains(
"FROM settings WHERE module='chatroom'",
false))
128 ->willReturn($chatroomSettings);
131 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->onlyMethods(
132 [
'checkAccess',
'checkAccessOfUser']
134 $rbacsystem->method(
'checkAccess')->with(
135 $this->logicalOr($this->equalTo(
'read'), $this->equalTo(
'visible'), $this->equalTo(
'write')),
138 $rbacsystem->method(
'checkAccessOfUser')->with(
140 $this->logicalOr($this->equalTo(
'read'), $this->equalTo(
'visible'), $this->equalTo(
'write')),
146 $this->assertTrue($this->access::_checkGoto(
'chtr_5'));
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setGlobalVariable(string $name, $value)
◆ $access
◆ $db
The documentation for this class was generated from the following file: