Class ilObjChatroomAccessTest.
More...
◆ setUp()
ilObjChatroomAccessTest::setUp |
( |
| ) |
|
|
protected |
◆ testAccessChecksFail()
ilObjChatroomAccessTest::testAccessChecksFail |
( |
| ) |
|
Definition at line 153 of file ilObjChatroomAccessTest.php.
References $objId, $refId, ILIAS\Repository\access(), and ilChatroomAbstractTestBase\setGlobalVariable().
159 $user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->onlyMethods(
162 $user->expects($this->once())->method(
'getId')->willReturn($userId);
166 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->onlyMethods(
167 [
'checkAccessOfUser']
169 $rbacsystem->expects($this->once())->method(
'checkAccessOfUser')->with(
170 $this->equalTo($userId),
171 $this->equalTo(
'write'),
173 )->willReturn(
false);
setGlobalVariable(string $name, $value)
◆ testAccessChecksSucceed()
ilObjChatroomAccessTest::testAccessChecksSucceed |
( |
| ) |
|
Definition at line 180 of file ilObjChatroomAccessTest.php.
References $objId, $refId, ILIAS\Repository\access(), null, and ilChatroomAbstractTestBase\setGlobalVariable().
186 $user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->onlyMethods(
189 $user->expects($this->once())->method(
'getId')->willReturn($userId);
193 $this->db->method(
'fetchAssoc')->willReturnOnConsecutiveCalls(
194 [
'keyword' =>
'chat_enabled',
'value' =>
'0'],
198 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->onlyMethods(
199 [
'checkAccessOfUser']
201 $rbacsystem->expects($this->once())->method(
'checkAccessOfUser')->with(
202 $this->equalTo($userId),
203 $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')
69 ->willReturnCallback(
static function (
ilDBStatement $statement) {
75 ->with($this->stringContains(
"FROM settings WHERE module='chatroom'",
false))
76 ->willReturn($chatroomSettings);
79 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->onlyMethods(
80 [
'checkAccess',
'checkAccessOfUser']
82 $rbacsystem->method(
'checkAccess')->with(
83 $this->logicalOr($this->equalTo(
'read'), $this->equalTo(
'visible')),
86 $rbacsystem->method(
'checkAccessOfUser')->with(
88 $this->logicalOr($this->equalTo(
'read'), $this->equalTo(
'visible')),
94 $this->assertFalse($this->access::_checkGoto(
''));
95 $this->assertFalse($this->access::_checkGoto(
'chtr'));
96 $this->assertFalse($this->access::_checkGoto(
'chtr_'));
97 $this->assertFalse($this->access::_checkGoto(
'chtr_'));
98 $this->assertFalse($this->access::_checkGoto(
'chtr_test'));
99 $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 102 of file ilObjChatroomAccessTest.php.
References ilDBStatement\fetchAssoc(), null, and ilChatroomAbstractTestBase\setGlobalVariable().
104 $user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->onlyMethods(
107 $user->method(
'getId')->willReturn(6);
109 $this->
setGlobalVariable(
'ilObjDataCache', $this->createMock(ilObjectDataCache::class));
112 $chatroomSettings = $this->createMock(ilDBStatement::class);
114 ->method(
'fetchAssoc')
115 ->willReturnOnConsecutiveCalls(
117 'keyword' =>
'public_room_ref',
124 ->method(
'fetchAssoc')
125 ->willReturnCallback(
static function (
ilDBStatement $statement) {
131 ->with($this->stringContains(
"FROM settings WHERE module='chatroom'",
false))
132 ->willReturn($chatroomSettings);
135 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->onlyMethods(
136 [
'checkAccess',
'checkAccessOfUser']
138 $rbacsystem->method(
'checkAccess')->with(
139 $this->logicalOr($this->equalTo(
'read'), $this->equalTo(
'visible'), $this->equalTo(
'write')),
142 $rbacsystem->method(
'checkAccessOfUser')->with(
144 $this->logicalOr($this->equalTo(
'read'), $this->equalTo(
'visible'), $this->equalTo(
'write')),
150 $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: