ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilChatroomAbstractTaskTestBase Class Reference

Class ilChatroomAbstractTaskTest. More...

+ 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

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

Detailed Description

Class ilChatroomAbstractTaskTest.

Author
Thomas Joußen tjous.nosp@m.sen@.nosp@m.gmx.d.nosp@m.e

Definition at line 29 of file ilChatroomAbstractTaskTestBase.php.

Member Function Documentation

◆ createGlobalIlCtrlMock()

ilChatroomAbstractTaskTestBase::createGlobalIlCtrlMock ( )
protected

Definition at line 93 of file ilChatroomAbstractTaskTestBase.php.

References $GLOBALS, and ilChatroomAbstractTestBase\setGlobalVariable().

94  {
95  $ctrl = $this->createMock(ilCtrlInterface::class);
96 
97  $this->setGlobalVariable('ilCtrl', $ctrl);
98 
99  return $GLOBALS['ilCtrl'];
100  }
$GLOBALS["DIC"]
Definition: wac.php:53
+ Here is the call graph for this function:

◆ createGlobalIlLanguageMock()

ilChatroomAbstractTaskTestBase::createGlobalIlLanguageMock ( )
protected

Definition at line 47 of file ilChatroomAbstractTaskTestBase.php.

References $lng, and ilChatroomAbstractTestBase\setGlobalVariable().

47  : ilLanguage
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  }
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:

◆ createGlobalIlUserMock()

ilChatroomAbstractTaskTestBase::createGlobalIlUserMock ( )
protected

Definition at line 102 of file ilChatroomAbstractTaskTestBase.php.

References ilChatroomAbstractTestBase\setGlobalVariable().

102  : ilObjUser
103  {
104  $user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->getMock();
105 
106  $this->setGlobalVariable('ilUser', $user);
107 
108  return $user;
109  }
+ Here is the call graph for this function:

◆ createGlobalRbacSystemCheckAccessMock()

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

Definition at line 77 of file ilChatroomAbstractTaskTestBase.php.

References $GLOBALS, and null.

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$GLOBALS["DIC"]
Definition: wac.php:53

◆ createGlobalRbacSystemMock()

ilChatroomAbstractTaskTestBase::createGlobalRbacSystemMock ( )
protected

Definition at line 66 of file ilChatroomAbstractTaskTestBase.php.

References ilChatroomAbstractTestBase\setGlobalVariable().

66  : ilRbacSystem
67  {
68  $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->onlyMethods(
69  ['checkAccess']
70  )->getMock();
71 
72  $this->setGlobalVariable('rbacsystem', $rbacsystem);
73 
74  return $rbacsystem;
75  }
+ Here is the call graph for this function:

◆ createIlChatroomIsOwnerOfPrivateRoomMock()

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

Definition at line 116 of file ilChatroomAbstractTaskTestBase.php.

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

◆ createIlChatroomServerConnectorFileGetContentsMock()

ilChatroomAbstractTaskTestBase::createIlChatroomServerConnectorFileGetContentsMock (   $returnValue)
protected

Definition at line 142 of file ilChatroomAbstractTaskTestBase.php.

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

◆ createIlChatroomServerConnectorMock()

ilChatroomAbstractTaskTestBase::createIlChatroomServerConnectorMock ( ilChatroomServerSettings  $settings)
protected

Definition at line 132 of file ilChatroomAbstractTaskTestBase.php.

References $ilChatroomServerConnectorMock.

135  $this->ilChatroomServerConnectorMock = $this->getMockBuilder(ilChatroomServerConnector::class)->setConstructorArgs(
136  [$settings]
137  )->onlyMethods(['file_get_contents'])->getMock();
138 
140  }
Class ilChatroomServerConnector.

◆ createIlChatroomUserGetUserIdMock()

ilChatroomAbstractTaskTestBase::createIlChatroomUserGetUserIdMock ( int  $userId)
protected

Definition at line 127 of file ilChatroomAbstractTaskTestBase.php.

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

◆ createIlObjChatroomGUIGetConnectorMock()

ilChatroomAbstractTaskTestBase::createIlObjChatroomGUIGetConnectorMock (   $returnValue)
protected

Definition at line 111 of file ilChatroomAbstractTaskTestBase.php.

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

◆ createIlObjChatroomMock()

ilChatroomAbstractTaskTestBase::createIlObjChatroomMock ( int  $id)
protected

Definition at line 149 of file ilChatroomAbstractTaskTestBase.php.

References $object.

149  : ilObjChatroom
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

◆ createSendResponseMock()

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

Definition at line 159 of file ilChatroomAbstractTaskTestBase.php.

References $response.

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

◆ setUp()

ilChatroomAbstractTaskTestBase::setUp ( )
protected

Definition at line 38 of file ilChatroomAbstractTaskTestBase.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

ilChatroomAbstractTaskTestBase::$gui
protected

Definition at line 32 of file ilChatroomAbstractTaskTestBase.php.

◆ $ilChatroomServerConnectorMock

ilChatroomAbstractTaskTestBase::$ilChatroomServerConnectorMock
protected

◆ $object

ilChatroomAbstractTaskTestBase::$object
protected

Definition at line 36 of file ilChatroomAbstractTaskTestBase.php.

Referenced by createIlObjChatroomMock().


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