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

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 ilChatroomAbstractTestBase
 setUp ()
 
 tearDown ()
 
 createIlChatroomUserMock ()
 
 createGlobalIlDBMock ()
 
 setGlobalVariable (string $name, $value)
 

Protected Attributes

MockObject &ilChatroomObjectGUI $gui
 
MockObject &ilChatroomServerConnector $ilChatroomServerConnectorMock
 
MockObject &ilObjChatroom $object
 
- Protected Attributes inherited from ilChatroomAbstractTestBase
MockObject &ilChatroom $ilChatroomMock
 
MockObject &ilChatroomUser $ilChatroomUserMock
 

Detailed Description

Definition at line 25 of file ilChatroomAbstractTaskTestBase.php.

Member Function Documentation

◆ createGlobalIlCtrlMock()

ilChatroomAbstractTaskTestBase::createGlobalIlCtrlMock ( )
protected

Definition at line 86 of file ilChatroomAbstractTaskTestBase.php.

87 {
88 $ctrl = $this->createMock(ilCtrlInterface::class);
89
90 $this->setGlobalVariable('ilCtrl', $ctrl);
91
92 return $GLOBALS['ilCtrl'];
93 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$GLOBALS["DIC"]
Definition: wac.php:54

References $GLOBALS, and ilChatroomAbstractTestBase\setGlobalVariable().

+ Here is the call graph for this function:

◆ createGlobalIlLanguageMock()

ilChatroomAbstractTaskTestBase::createGlobalIlLanguageMock ( )
protected

Definition at line 40 of file ilChatroomAbstractTaskTestBase.php.

41 {
42 $lng = $this->getMockBuilder(ilLanguage::class)->disableOriginalConstructor()->onlyMethods(
43 ['loadLanguageModule', 'txt']
44 )->getMock();
45
46 $lng->method('loadLanguageModule')->with(
47 $this->logicalOr(
48 $this->equalTo('chatroom'),
49 $this->equalTo('meta')
50 )
51 );
52 $lng->method('txt');
53
54 $this->setGlobalVariable('lng', $lng);
55
56 return $lng;
57 }
language handling
global $lng
Definition: privfeed.php:31

References $lng, and ilChatroomAbstractTestBase\setGlobalVariable().

+ Here is the call graph for this function:

◆ createGlobalIlUserMock()

ilChatroomAbstractTaskTestBase::createGlobalIlUserMock ( )
protected

Definition at line 95 of file ilChatroomAbstractTaskTestBase.php.

95 : ilObjUser
96 {
97 $user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->getMock();
98
99 $this->setGlobalVariable('ilUser', $user);
100
101 return $user;
102 }
User class.

References ilChatroomAbstractTestBase\setGlobalVariable().

+ Here is the call graph for this function:

◆ createGlobalRbacSystemCheckAccessMock()

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

Definition at line 70 of file ilChatroomAbstractTaskTestBase.php.

74 {
75 if ($times === null) {
76 $times = $this->any();
77 }
78
79 return $GLOBALS['rbacsystem']->expects($times)
80 ->method('checkAccess')
81 ->with($this->equalTo($permission))->willReturn(
82 $result
83 );
84 }

References $GLOBALS.

◆ createGlobalRbacSystemMock()

ilChatroomAbstractTaskTestBase::createGlobalRbacSystemMock ( )
protected

Definition at line 59 of file ilChatroomAbstractTaskTestBase.php.

60 {
61 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->onlyMethods(
62 ['checkAccess']
63 )->getMock();
64
65 $this->setGlobalVariable('rbacsystem', $rbacsystem);
66
67 return $rbacsystem;
68 }
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...

References ilChatroomAbstractTestBase\setGlobalVariable().

+ Here is the call graph for this function:

◆ createIlChatroomIsOwnerOfPrivateRoomMock()

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

Definition at line 109 of file ilChatroomAbstractTaskTestBase.php.

113 : InvocationMocker {
114 return $this->ilChatroomMock->method('isOwnerOfPrivateRoom')->with(
115 $this->equalTo($userId),
116 $this->equalTo($subRoomId)
117 )->willReturn($result);
118 }

◆ createIlChatroomServerConnectorFileGetContentsMock()

ilChatroomAbstractTaskTestBase::createIlChatroomServerConnectorFileGetContentsMock (   $returnValue)
protected

Definition at line 135 of file ilChatroomAbstractTaskTestBase.php.

135 : InvocationMocker
136 {
137 return $this->ilChatroomServerConnectorMock->method('file_get_contents')->willReturn(
138 $returnValue
139 );
140 }

◆ createIlChatroomServerConnectorMock()

ilChatroomAbstractTaskTestBase::createIlChatroomServerConnectorMock ( ilChatroomServerSettings  $settings)
protected

Definition at line 125 of file ilChatroomAbstractTaskTestBase.php.

128 $this->ilChatroomServerConnectorMock = $this->getMockBuilder(ilChatroomServerConnector::class)->setConstructorArgs(
129 [$settings]
130 )->onlyMethods(['file_get_contents'])->getMock();
131
133 }
MockObject &ilChatroomServerConnector $ilChatroomServerConnectorMock
Class ilChatroomServerConnector.

◆ createIlChatroomUserGetUserIdMock()

ilChatroomAbstractTaskTestBase::createIlChatroomUserGetUserIdMock ( int  $userId)
protected

Definition at line 120 of file ilChatroomAbstractTaskTestBase.php.

120 : InvocationMocker
121 {
122 return $this->ilChatroomUserMock->method('getUserId')->willReturn($userId);
123 }

◆ createIlObjChatroomGUIGetConnectorMock()

ilChatroomAbstractTaskTestBase::createIlObjChatroomGUIGetConnectorMock (   $returnValue)
protected

Definition at line 104 of file ilChatroomAbstractTaskTestBase.php.

104 : void
105 {
106 $this->gui->method('getConnector')->willReturn($returnValue);
107 }

◆ createIlObjChatroomMock()

ilChatroomAbstractTaskTestBase::createIlObjChatroomMock ( int  $id)
protected

Definition at line 142 of file ilChatroomAbstractTaskTestBase.php.

143 {
144 $this->object = $this->getMockBuilder(ilObjChatroom::class)->disableOriginalConstructor()->onlyMethods(
145 ['getId']
146 )->getMock();
147 $this->object->method('getId')->willReturn($id);
148
149 return $this->object;
150 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ createSendResponseMock()

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

Definition at line 152 of file ilChatroomAbstractTaskTestBase.php.

152 : void
153 {
154 $mock->expects($this->once())->method('sendResponse')->with(
155 $this->equalTo($response)
156 )->willReturnCallback(
157 static function (): never {
158 throw new Exception('Exit', 0);
159 }
160 );
161 }
$response
Definition: xapitoken.php:93

References $response.

◆ setUp()

ilChatroomAbstractTaskTestBase::setUp ( )
protected

Reimplemented from ilChatroomAbstractTestBase.

Definition at line 31 of file ilChatroomAbstractTaskTestBase.php.

31 : void
32 {
33 parent::setUp();
34
35 if (!defined('ROOT_FOLDER_ID')) {
36 define('ROOT_FOLDER_ID', time());
37 }
38 }

Field Documentation

◆ $gui

MockObject& ilChatroomObjectGUI ilChatroomAbstractTaskTestBase::$gui
protected

Definition at line 27 of file ilChatroomAbstractTaskTestBase.php.

◆ $ilChatroomServerConnectorMock

MockObject& ilChatroomServerConnector ilChatroomAbstractTaskTestBase::$ilChatroomServerConnectorMock
protected

Definition at line 28 of file ilChatroomAbstractTaskTestBase.php.

◆ $object

MockObject& ilObjChatroom ilChatroomAbstractTaskTestBase::$object
protected

Definition at line 29 of file ilChatroomAbstractTaskTestBase.php.


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