ILIAS  release_8 Revision v8.24
ilObjChatroomAdminAccessTest Class Reference

Class ilObjChatroomAdminAccessTest. More...

+ Inheritance diagram for ilObjChatroomAdminAccessTest:
+ Collaboration diagram for ilObjChatroomAdminAccessTest:

Public Member Functions

 testCommandDefitionFullfilsExpectations ()
 
 testGotoCheckFails ()
 
 testGotoCheckSucceeds ()
 

Protected Member Functions

 setUp ()
 
- Protected Member Functions inherited from ilChatroomAbstractTest
 setUp ()
 
 tearDown ()
 
 createIlChatroomMock ()
 
 createIlChatroomUserMock ()
 
 createGlobalIlDBMock ()
 
 setGlobalVariable (string $name, $value)
 

Protected Attributes

ilObjChatroomAdminAccess $adminAccess
 
ilRbacSystem $ilAccessMock
 
- Protected Attributes inherited from ilChatroomAbstractTest
 $ilChatroomMock
 
 $ilChatroomUserMock
 

Detailed Description

Member Function Documentation

◆ setUp()

ilObjChatroomAdminAccessTest::setUp ( )
protected

Reimplemented from ilChatroomAbstractTest.

Definition at line 76 of file class.ilObjChatroomAdminAccessTest.php.

76 : void
77 {
78 parent::setUp();
79
80 $this->ilAccessMock = $this->getMockBuilder(ilRbacSystem::class)
81 ->disableOriginalConstructor()
82 ->onlyMethods(['checkAccess'])
83 ->getMock();
84 $this->setGlobalVariable('rbacsystem', $this->ilAccessMock);
85
86 $this->adminAccess = new ilObjChatroomAdminAccess();
87 }
setGlobalVariable(string $name, $value)
Class ilObjChatroomAdminAccess Access class for chatroom objects.

References ilChatroomAbstractTest\setGlobalVariable().

+ Here is the call graph for this function:

◆ testCommandDefitionFullfilsExpectations()

ilObjChatroomAdminAccessTest::testCommandDefitionFullfilsExpectations ( )

Definition at line 33 of file class.ilObjChatroomAdminAccessTest.php.

33 : void
34 {
35 $expected = [
36 ['permission' => 'read', 'cmd' => 'view', 'lang_var' => 'enter', 'default' => true],
37 ['permission' => 'write', 'cmd' => 'edit', 'lang_var' => 'edit'],
38 ['permission' => 'write', 'cmd' => 'versions', 'lang_var' => 'versions'],
39 ];
40
41 $commands = $this->adminAccess::_getCommands();
42
43 $this->assertIsArray($commands);
44 $this->assertSame($expected, $commands);
45 }

◆ testGotoCheckFails()

ilObjChatroomAdminAccessTest::testGotoCheckFails ( )

Definition at line 47 of file class.ilObjChatroomAdminAccessTest.php.

47 : void
48 {
49 $this->ilAccessMock
50 ->method('checkAccess')
51 ->with(
52 $this->equalTo('visible'),
53 $this->equalTo('1')
54 )->willReturn(false);
55
56 $this->assertFalse($this->adminAccess::_checkGoto(''));
57 $this->assertFalse($this->adminAccess::_checkGoto('chtr'));
58 $this->assertFalse($this->adminAccess::_checkGoto('chtr_'));
59 $this->assertFalse($this->adminAccess::_checkGoto('chtr_'));
60 $this->assertFalse($this->adminAccess::_checkGoto('chtr_test'));
61 $this->assertFalse($this->adminAccess::_checkGoto('chtr_1'));
62 }

◆ testGotoCheckSucceeds()

ilObjChatroomAdminAccessTest::testGotoCheckSucceeds ( )

Definition at line 64 of file class.ilObjChatroomAdminAccessTest.php.

64 : void
65 {
66 $this->ilAccessMock->expects($this->once())
67 ->method('checkAccess')
68 ->with(
69 $this->equalTo('visible'),
70 $this->equalTo('5')
71 )->willReturn(true);
72
73 $this->assertTrue($this->adminAccess::_checkGoto('chtr_5'));
74 }

Field Documentation

◆ $adminAccess

ilObjChatroomAdminAccess ilObjChatroomAdminAccessTest::$adminAccess
protected

Definition at line 29 of file class.ilObjChatroomAdminAccessTest.php.

◆ $ilAccessMock

ilRbacSystem ilObjChatroomAdminAccessTest::$ilAccessMock
protected

Definition at line 31 of file class.ilObjChatroomAdminAccessTest.php.


The documentation for this class was generated from the following file: