ILIAS  release_8 Revision v8.24
ilChatroomAbstractTaskTest Class Reference

Class ilChatroomAbstractTaskTest. More...

+ Inheritance diagram for ilChatroomAbstractTaskTest:
+ Collaboration diagram for ilChatroomAbstractTaskTest:

Protected Member Functions

 setUp ()
 
 createGlobalIlLanguageMock ()
 
 createGlobalRbacSystemMock ()
 
 createGlobalRbacSystemCheckAccessMock (string $permission, bool $result, ?InvocationOrder $times=null)
 
 createGlobalIlCtrlMock ()
 
 createGlobalIlUserMock ()
 
 createIlObjChatroomGUIGetConnectorMock ($returnValue)
 
 createIlChatroomIsOwnerOfPrivateRoomMock (int $userId, int $subRoomId, bool $result)
 
 createIlChatroomUserGetUserIdMock (int $userId)
 
 createIlChatroomServerConnectorMock (ilChatroomServerSettings $settings)
 
 createIlChatroomServerConnectorFileGetContentsMock ($returnValue)
 
 createIlObjChatroomMock (int $id)
 
 createSendResponseMock (MockObject $mock, $response)
 
- Protected Member Functions inherited from ilChatroomAbstractTest
 setUp ()
 
 tearDown ()
 
 createIlChatroomMock ()
 
 createIlChatroomUserMock ()
 
 createGlobalIlDBMock ()
 
 setGlobalVariable (string $name, $value)
 

Protected Attributes

 $gui
 
 $ilChatroomServerConnectorMock
 
 $object
 
- Protected Attributes inherited from ilChatroomAbstractTest
 $ilChatroomMock
 
 $ilChatroomUserMock
 

Detailed Description

Member Function Documentation

◆ createGlobalIlCtrlMock()

ilChatroomAbstractTaskTest::createGlobalIlCtrlMock ( )
protected

Definition at line 93 of file class.ilChatroomAbstractTaskTest.php.

94 {
95 $ctrl = $this->createMock(ilCtrlInterface::class);
96
97 $this->setGlobalVariable('ilCtrl', $ctrl);
98
99 return $GLOBALS['ilCtrl'];
100 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
setGlobalVariable(string $name, $value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $GLOBALS, and ilChatroomAbstractTest\setGlobalVariable().

+ Here is the call graph for this function:

◆ createGlobalIlLanguageMock()

ilChatroomAbstractTaskTest::createGlobalIlLanguageMock ( )
protected

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

48 {
49 $lng = $this->getMockBuilder(ilLanguage::class)->disableOriginalConstructor()->onlyMethods(
50 ['loadLanguageModule', 'txt']
51 )->getMock();
52
53 $lng->method('loadLanguageModule')->with(
54 $this->logicalOr(
55 $this->equalTo('chatroom'),
56 $this->equalTo('meta')
57 )
58 );
59 $lng->method('txt');
60
61 $this->setGlobalVariable('lng', $lng);
62
63 return $lng;
64 }
language handling
$lng

References $lng, and ilChatroomAbstractTest\setGlobalVariable().

+ Here is the call graph for this function:

◆ createGlobalIlUserMock()

ilChatroomAbstractTaskTest::createGlobalIlUserMock ( )
protected

Definition at line 102 of file class.ilChatroomAbstractTaskTest.php.

102 : ilObjUser
103 {
104 $user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->getMock();
105
106 $this->setGlobalVariable('ilUser', $user);
107
108 return $user;
109 }
User class.

References ilChatroomAbstractTest\setGlobalVariable().

+ Here is the call graph for this function:

◆ createGlobalRbacSystemCheckAccessMock()

ilChatroomAbstractTaskTest::createGlobalRbacSystemCheckAccessMock ( string  $permission,
bool  $result,
?InvocationOrder  $times = null 
)
protected

Definition at line 77 of file class.ilChatroomAbstractTaskTest.php.

81 {
82 if ($times === null) {
83 $times = $this->any();
84 }
85
86 return $GLOBALS['rbacsystem']->expects($times)
87 ->method('checkAccess')
88 ->with($this->equalTo($permission))->willReturn(
89 $result
90 );
91 }

References $GLOBALS.

◆ createGlobalRbacSystemMock()

ilChatroomAbstractTaskTest::createGlobalRbacSystemMock ( )
protected

Definition at line 66 of file class.ilChatroomAbstractTaskTest.php.

67 {
68 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->onlyMethods(
69 ['checkAccess']
70 )->getMock();
71
72 $this->setGlobalVariable('rbacsystem', $rbacsystem);
73
74 return $rbacsystem;
75 }
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...

References ilChatroomAbstractTest\setGlobalVariable().

+ Here is the call graph for this function:

◆ createIlChatroomIsOwnerOfPrivateRoomMock()

ilChatroomAbstractTaskTest::createIlChatroomIsOwnerOfPrivateRoomMock ( int  $userId,
int  $subRoomId,
bool  $result 
)
protected

Definition at line 116 of file class.ilChatroomAbstractTaskTest.php.

120 : InvocationMocker {
121 return $this->ilChatroomMock->method('isOwnerOfPrivateRoom')->with(
122 $this->equalTo($userId),
123 $this->equalTo($subRoomId)
124 )->willReturn($result);
125 }

◆ createIlChatroomServerConnectorFileGetContentsMock()

ilChatroomAbstractTaskTest::createIlChatroomServerConnectorFileGetContentsMock (   $returnValue)
protected

Definition at line 142 of file class.ilChatroomAbstractTaskTest.php.

142 : InvocationMocker
143 {
144 return $this->ilChatroomServerConnectorMock->method('file_get_contents')->willReturn(
145 $returnValue
146 );
147 }

◆ createIlChatroomServerConnectorMock()

ilChatroomAbstractTaskTest::createIlChatroomServerConnectorMock ( ilChatroomServerSettings  $settings)
protected

Definition at line 132 of file class.ilChatroomAbstractTaskTest.php.

135 $this->ilChatroomServerConnectorMock = $this->getMockBuilder(ilChatroomServerConnector::class)->setConstructorArgs(
136 [$settings]
137 )->onlyMethods(['file_get_contents'])->getMock();
138
140 }
Class ilChatroomServerConnector.
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200

◆ createIlChatroomUserGetUserIdMock()

ilChatroomAbstractTaskTest::createIlChatroomUserGetUserIdMock ( int  $userId)
protected

Definition at line 127 of file class.ilChatroomAbstractTaskTest.php.

127 : InvocationMocker
128 {
129 return $this->ilChatroomUserMock->method('getUserId')->willReturn($userId);
130 }

◆ createIlObjChatroomGUIGetConnectorMock()

ilChatroomAbstractTaskTest::createIlObjChatroomGUIGetConnectorMock (   $returnValue)
protected

Definition at line 111 of file class.ilChatroomAbstractTaskTest.php.

111 : void
112 {
113 $this->gui->method('getConnector')->willReturn($returnValue);
114 }

◆ createIlObjChatroomMock()

ilChatroomAbstractTaskTest::createIlObjChatroomMock ( int  $id)
protected

Definition at line 149 of file class.ilChatroomAbstractTaskTest.php.

150 {
151 $this->object = $this->getMockBuilder(ilObjChatroom::class)->disableOriginalConstructor()->onlyMethods(
152 ['getId']
153 )->getMock();
154 $this->object->method('getId')->willReturn($id);
155
156 return $this->object;
157 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Class ilObjChatroom.

◆ createSendResponseMock()

ilChatroomAbstractTaskTest::createSendResponseMock ( MockObject  $mock,
  $response 
)
protected

Definition at line 159 of file class.ilChatroomAbstractTaskTest.php.

159 : void
160 {
161 $mock->expects($this->once())->method('sendResponse')->with(
162 $this->equalTo($response)
163 )->willReturnCallback(
164 static function (): void {
165 throw new Exception('Exit', 0);
166 }
167 );
168 }
$response

References $response.

◆ setUp()

ilChatroomAbstractTaskTest::setUp ( )
protected

Reimplemented from ilChatroomAbstractTest.

Definition at line 38 of file class.ilChatroomAbstractTaskTest.php.

38 : void
39 {
40 parent::setUp();
41
42 if (!defined('ROOT_FOLDER_ID')) {
43 define('ROOT_FOLDER_ID', time());
44 }
45 }

Field Documentation

◆ $gui

ilChatroomAbstractTaskTest::$gui
protected

Definition at line 32 of file class.ilChatroomAbstractTaskTest.php.

◆ $ilChatroomServerConnectorMock

ilChatroomAbstractTaskTest::$ilChatroomServerConnectorMock
protected

Definition at line 34 of file class.ilChatroomAbstractTaskTest.php.

◆ $object

ilChatroomAbstractTaskTest::$object
protected

Definition at line 36 of file class.ilChatroomAbstractTaskTest.php.


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