ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilObjChatroomAdminAccessTest Class Reference
+ Inheritance diagram for ilObjChatroomAdminAccessTest:
+ Collaboration diagram for ilObjChatroomAdminAccessTest:

Public Member Functions

 testCommandDefitionFullfilsExpectations ()
 
 testGotoCheckFails ()
 
 testGotoCheckSucceeds ()
 

Protected Member Functions

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

Protected Attributes

ilObjChatroomAdminAccess $adminAccess
 
ilRbacSystem &MockObject $ilAccessMock
 
- Protected Attributes inherited from ilChatroomAbstractTestBase
MockObject &ilChatroom $ilChatroomMock
 
MockObject &ilChatroomUser $ilChatroomUserMock
 

Detailed Description

Definition at line 23 of file ilObjChatroomAdminAccessTest.php.

Member Function Documentation

◆ setUp()

ilObjChatroomAdminAccessTest::setUp ( )
protected

Reimplemented from ilChatroomAbstractTestBase.

Definition at line 71 of file ilObjChatroomAdminAccessTest.php.

71 : void
72 {
73 parent::setUp();
74
75 $this->ilAccessMock = $this->getMockBuilder(ilRbacSystem::class)
76 ->disableOriginalConstructor()
77 ->onlyMethods(['checkAccess'])
78 ->getMock();
79 $this->setGlobalVariable('rbacsystem', $this->ilAccessMock);
80
81 $this->adminAccess = new ilObjChatroomAdminAccess();
82 }
Class ilObjChatroomAdminAccess Access class for chatroom objects.

References ilChatroomAbstractTestBase\setGlobalVariable().

+ Here is the call graph for this function:

◆ testCommandDefitionFullfilsExpectations()

ilObjChatroomAdminAccessTest::testCommandDefitionFullfilsExpectations ( )

Definition at line 28 of file ilObjChatroomAdminAccessTest.php.

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

◆ testGotoCheckFails()

ilObjChatroomAdminAccessTest::testGotoCheckFails ( )

Definition at line 42 of file ilObjChatroomAdminAccessTest.php.

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

◆ testGotoCheckSucceeds()

ilObjChatroomAdminAccessTest::testGotoCheckSucceeds ( )

Definition at line 59 of file ilObjChatroomAdminAccessTest.php.

59 : void
60 {
61 $this->ilAccessMock->expects($this->once())
62 ->method('checkAccess')
63 ->with(
64 $this->equalTo('visible'),
65 $this->equalTo('5')
66 )->willReturn(true);
67
68 $this->assertTrue($this->adminAccess::_checkGoto('chtr_5'));
69 }

Field Documentation

◆ $adminAccess

ilObjChatroomAdminAccess ilObjChatroomAdminAccessTest::$adminAccess
protected

Definition at line 25 of file ilObjChatroomAdminAccessTest.php.

◆ $ilAccessMock

ilRbacSystem& MockObject ilObjChatroomAdminAccessTest::$ilAccessMock
protected

Definition at line 26 of file ilObjChatroomAdminAccessTest.php.


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