Class ilObjChatroomAccessTest.
More...
◆ setUp()
ilObjChatroomAccessTest::setUp |
( |
| ) |
|
|
protected |
◆ testAccessChecksFail()
ilObjChatroomAccessTest::testAccessChecksFail |
( |
| ) |
|
Definition at line 151 of file class.ilObjChatroomAccessTest.php.
References $objId, $refId, ILIAS\Repository\access(), and ilChatroomAbstractTest\setGlobalVariable().
157 $user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->onlyMethods(
160 $user->expects($this->once())->method(
'getId')->willReturn($userId);
164 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->onlyMethods(
165 [
'checkAccessOfUser']
167 $rbacsystem->expects($this->once())->method(
'checkAccessOfUser')->with(
168 $this->equalTo($userId),
169 $this->equalTo(
'write'),
171 )->willReturn(
false);
setGlobalVariable(string $name, $value)
◆ testAccessChecksSucceed()
ilObjChatroomAccessTest::testAccessChecksSucceed |
( |
| ) |
|
Definition at line 178 of file class.ilObjChatroomAccessTest.php.
References $objId, $refId, ILIAS\Repository\access(), and ilChatroomAbstractTest\setGlobalVariable().
184 $user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->onlyMethods(
187 $user->expects($this->once())->method(
'getId')->willReturn($userId);
191 $this->db->method(
'fetchAssoc')->willReturnOnConsecutiveCalls(
192 [
'keyword' =>
'chat_enabled',
'value' =>
'0'],
196 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->onlyMethods(
197 [
'checkAccessOfUser']
199 $rbacsystem->expects($this->once())->method(
'checkAccessOfUser')->with(
200 $this->equalTo($userId),
201 $this->equalTo(
'write'),
setGlobalVariable(string $name, $value)
◆ testCommandDefitionFullfilsExpectations()
ilObjChatroomAccessTest::testCommandDefitionFullfilsExpectations |
( |
| ) |
|
Definition at line 33 of file class.ilObjChatroomAccessTest.php.
36 [
'permission' =>
'read',
'cmd' =>
'view',
'lang_var' =>
'enter',
'default' =>
true],
37 [
'permission' =>
'write',
'cmd' =>
'settings-general',
'lang_var' =>
'settings'],
40 $commands = $this->access::_getCommands();
42 $this->assertIsArray($commands);
43 $this->assertSame($expected, $commands);
◆ testGotoCheckFails()
ilObjChatroomAccessTest::testGotoCheckFails |
( |
| ) |
|
Definition at line 46 of file class.ilObjChatroomAccessTest.php.
References ilDBStatement\fetchAssoc(), and ilChatroomAbstractTest\setGlobalVariable().
48 $user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->onlyMethods(
51 $user->method(
'getId')->willReturn(6);
55 $chatroomSettings = $this->createMock(ilDBStatement::class);
57 ->method(
'fetchAssoc')
58 ->willReturnOnConsecutiveCalls(
60 'keyword' =>
'public_room_ref',
67 ->method(
'fetchAssoc')
68 ->willReturnCallback(
static function (
ilDBStatement $statement) {
74 ->with($this->stringContains(
"FROM settings WHERE module='chatroom'",
false))
75 ->willReturn($chatroomSettings);
78 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->onlyMethods(
79 [
'checkAccess',
'checkAccessOfUser']
81 $rbacsystem->method(
'checkAccess')->with(
82 $this->logicalOr($this->equalTo(
'read'), $this->equalTo(
'visible')),
85 $rbacsystem->method(
'checkAccessOfUser')->with(
87 $this->logicalOr($this->equalTo(
'read'), $this->equalTo(
'visible')),
93 $this->assertFalse($this->access::_checkGoto(
''));
94 $this->assertFalse($this->access::_checkGoto(
'chtr'));
95 $this->assertFalse($this->access::_checkGoto(
'chtr_'));
96 $this->assertFalse($this->access::_checkGoto(
'chtr_'));
97 $this->assertFalse($this->access::_checkGoto(
'chtr_test'));
98 $this->assertFalse($this->access::_checkGoto(
'chtr_1'));
setGlobalVariable(string $name, $value)
◆ testGotoCheckSucceeds()
ilObjChatroomAccessTest::testGotoCheckSucceeds |
( |
| ) |
|
Definition at line 101 of file class.ilObjChatroomAccessTest.php.
References ilDBStatement\fetchAssoc(), and ilChatroomAbstractTest\setGlobalVariable().
103 $user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->onlyMethods(
106 $user->method(
'getId')->willReturn(6);
110 $chatroomSettings = $this->createMock(ilDBStatement::class);
112 ->method(
'fetchAssoc')
113 ->willReturnOnConsecutiveCalls(
115 'keyword' =>
'public_room_ref',
122 ->method(
'fetchAssoc')
123 ->willReturnCallback(
static function (
ilDBStatement $statement) {
129 ->with($this->stringContains(
"FROM settings WHERE module='chatroom'",
false))
130 ->willReturn($chatroomSettings);
133 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->onlyMethods(
134 [
'checkAccess',
'checkAccessOfUser']
136 $rbacsystem->method(
'checkAccess')->with(
137 $this->logicalOr($this->equalTo(
'read'), $this->equalTo(
'visible'), $this->equalTo(
'write')),
140 $rbacsystem->method(
'checkAccessOfUser')->with(
142 $this->logicalOr($this->equalTo(
'read'), $this->equalTo(
'visible'), $this->equalTo(
'write')),
148 $this->assertTrue($this->access::_checkGoto(
'chtr_5'));
setGlobalVariable(string $name, $value)
◆ $access
◆ $db
The documentation for this class was generated from the following file: