Class ilObjChatroomAccessTest.
More...
◆ setUp()
| ilObjChatroomAccessTest::setUp |
( |
| ) |
|
|
protected |
◆ testAccessChecksFail()
| ilObjChatroomAccessTest::testAccessChecksFail |
( |
| ) |
|
Definition at line 154 of file ilObjChatroomAccessTest.php.
References $objId, $refId, ILIAS\Repository\access(), and ilChatroomAbstractTestBase\setGlobalVariable().
160 $user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->onlyMethods(
163 $user->expects($this->once())->method(
'getId')->willReturn($userId);
167 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->onlyMethods(
168 [
'checkAccessOfUser']
170 $rbacsystem->expects($this->once())->method(
'checkAccessOfUser')->with(
171 $this->equalTo($userId),
172 $this->equalTo(
'write'),
174 )->willReturn(
false);
setGlobalVariable(string $name, $value)
◆ testAccessChecksSucceed()
| ilObjChatroomAccessTest::testAccessChecksSucceed |
( |
| ) |
|
Definition at line 181 of file ilObjChatroomAccessTest.php.
References $objId, $refId, ILIAS\Repository\access(), and ilChatroomAbstractTestBase\setGlobalVariable().
187 $user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->onlyMethods(
190 $user->expects($this->once())->method(
'getId')->willReturn($userId);
194 $this->db->method(
'fetchAssoc')->willReturnOnConsecutiveCalls(
195 [
'keyword' =>
'chat_enabled',
'value' =>
'0'],
199 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->onlyMethods(
200 [
'checkAccessOfUser']
202 $rbacsystem->expects($this->once())->method(
'checkAccessOfUser')->with(
203 $this->equalTo($userId),
204 $this->equalTo(
'write'),
setGlobalVariable(string $name, $value)
◆ testCommandDefitionFullfilsExpectations()
| ilObjChatroomAccessTest::testCommandDefitionFullfilsExpectations |
( |
| ) |
|
Definition at line 33 of file 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 ilObjChatroomAccessTest.php.
References ilDBStatement\fetchAssoc(), and ilChatroomAbstractTestBase\setGlobalVariable().
48 $user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->onlyMethods(
51 $user->method(
'getId')->willReturn(6);
53 $this->
setGlobalVariable(
'ilObjDataCache', $this->createMock(ilObjectDataCache::class));
57 $chatroomSettings = $this->createMock(ilDBStatement::class);
59 ->method(
'fetchAssoc')
60 ->willReturnOnConsecutiveCalls(
62 'keyword' =>
'public_room_ref',
69 ->method(
'fetchAssoc')
70 ->willReturnCallback(
static function (
ilDBStatement $statement) {
76 ->with($this->stringContains(
"FROM settings WHERE module='chatroom'",
false))
77 ->willReturn($chatroomSettings);
80 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->onlyMethods(
81 [
'checkAccess',
'checkAccessOfUser']
83 $rbacsystem->method(
'checkAccess')->with(
84 $this->logicalOr($this->equalTo(
'read'), $this->equalTo(
'visible')),
87 $rbacsystem->method(
'checkAccessOfUser')->with(
89 $this->logicalOr($this->equalTo(
'read'), $this->equalTo(
'visible')),
95 $this->assertFalse($this->access::_checkGoto(
''));
96 $this->assertFalse($this->access::_checkGoto(
'chtr'));
97 $this->assertFalse($this->access::_checkGoto(
'chtr_'));
98 $this->assertFalse($this->access::_checkGoto(
'chtr_'));
99 $this->assertFalse($this->access::_checkGoto(
'chtr_test'));
100 $this->assertFalse($this->access::_checkGoto(
'chtr_1'));
setGlobalVariable(string $name, $value)
◆ testGotoCheckSucceeds()
| ilObjChatroomAccessTest::testGotoCheckSucceeds |
( |
| ) |
|
Definition at line 103 of file ilObjChatroomAccessTest.php.
References ilDBStatement\fetchAssoc(), and ilChatroomAbstractTestBase\setGlobalVariable().
105 $user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->onlyMethods(
108 $user->method(
'getId')->willReturn(6);
110 $this->
setGlobalVariable(
'ilObjDataCache', $this->createMock(ilObjectDataCache::class));
113 $chatroomSettings = $this->createMock(ilDBStatement::class);
115 ->method(
'fetchAssoc')
116 ->willReturnOnConsecutiveCalls(
118 'keyword' =>
'public_room_ref',
125 ->method(
'fetchAssoc')
126 ->willReturnCallback(
static function (
ilDBStatement $statement) {
132 ->with($this->stringContains(
"FROM settings WHERE module='chatroom'",
false))
133 ->willReturn($chatroomSettings);
136 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->onlyMethods(
137 [
'checkAccess',
'checkAccessOfUser']
139 $rbacsystem->method(
'checkAccess')->with(
140 $this->logicalOr($this->equalTo(
'read'), $this->equalTo(
'visible'), $this->equalTo(
'write')),
143 $rbacsystem->method(
'checkAccessOfUser')->with(
145 $this->logicalOr($this->equalTo(
'read'), $this->equalTo(
'visible'), $this->equalTo(
'write')),
151 $this->assertTrue($this->access::_checkGoto(
'chtr_5'));
setGlobalVariable(string $name, $value)
◆ $access
◆ $db
The documentation for this class was generated from the following file: