ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilChatroomAbstractTaskTest Class Reference

Class ilChatroomAbstractTaskTest. More...

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

Data Fields

const TEST_REF_ID = 99
 

Protected Member Functions

 setUp ()
 
 createGlobalIlLanguageMock ()
 
 createGlobalRbacSystemMock ()
 
 createGlobalRbacSystemCheckAccessMock ($permission, $result, $times=null)
 
 createGlobalIlCtrlMock ()
 
 createGlobalIlUserMock ()
 
 createIlObjChatroomGUIMock ($object)
 
 createIlObjChatroomGUIGetConnectorMock ($returnValue)
 
 createIlChatroomIsOwnerOfPrivateRoomMock ($userId, $subRoomId, $result)
 
 createIlChatroomUserGetUserIdMock ($userId)
 
 createIlChatroomServerConnectorMock ($settings)
 
 createIlChatroomServerConnectorFileGetContentsMock ($returnValue)
 
 createIlObjChatroomMock ($id)
 
 createSendResponseMock ($mock, $response)
 
- Protected Member Functions inherited from ilChatroomAbstractTest
 setUp ()
 
 createIlChatroomMock ()
 
 createIlChatroomUserMock ()
 
 createGlobalIlDBMock ()
 

Protected Attributes

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

Detailed Description

Member Function Documentation

◆ createGlobalIlCtrlMock()

ilChatroomAbstractTaskTest::createGlobalIlCtrlMock ( )
protected

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

References $GLOBALS, and array.

Referenced by ilChatroomTaskHandlerTest\setUp(), ilChatroomInfoTaskTest\setUp(), and ilChatroomClearTaskTest\setUp().

82  {
83  require_once './Services/UICore/classes/class.ilCtrl.php';
84 
85  $GLOBALS['ilCtrl'] = $this->getMockBuilder('ilCtrl')->disableOriginalConstructor()->setMethods(
86  array('setParameterByClass', 'redirectByClass', 'forwardCommand')
87  )->getMock();
88  $GLOBALS['ilCtrl']->expects($this->any())->method('setParameterByClass');
89  $GLOBALS['ilCtrl']->expects($this->any())->method('redirectByClass');
90 
91  return $GLOBALS['ilCtrl'];
92  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ createGlobalIlLanguageMock()

ilChatroomAbstractTaskTest::createGlobalIlLanguageMock ( )
protected

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

References $GLOBALS, and array.

Referenced by ilChatroomTaskHandlerTest\setUp(), ilChatroomInfoTaskTest\setUp(), and ilChatroomClearTaskTest\setUp().

42  {
43  require_once './Services/Language/classes/class.ilLanguage.php';
44  $GLOBALS['lng'] = $this->getMockBuilder('ilLanguage')->disableOriginalConstructor()->setMethods(
45  array('loadLanguageModule', 'txt')
46  )->getMock();
47 
48  $GLOBALS['lng']->expects($this->any())->method('loadLanguageModule')->with($this->logicalOr($this->equalTo('chatroom'), $this->equalTo('meta')));
49  $GLOBALS['lng']->expects($this->any())->method('txt');
50 
51  return $GLOBALS['lng'];
52  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ createGlobalIlUserMock()

ilChatroomAbstractTaskTest::createGlobalIlUserMock ( )
protected

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

References $GLOBALS, and array.

Referenced by ilChatroomTaskHandlerTest\setUp(), and ilChatroomClearTaskTest\setUp().

95  {
96  require_once 'Services/User/classes/class.ilObjUser.php';
97 
98  $GLOBALS['ilUser'] = $this->getMockBuilder('ilObjUser')->disableOriginalConstructor()->setMethods(
99  array()
100  )->getMock();
101 
102  return $GLOBALS['ilUser'];
103  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ createGlobalRbacSystemCheckAccessMock()

ilChatroomAbstractTaskTest::createGlobalRbacSystemCheckAccessMock (   $permission,
  $result,
  $times = null 
)
protected
Parameters
PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount$times
string$permission
boolean$result

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

References $GLOBALS, and $result.

Referenced by ilChatroomTaskHandlerTest\testCanModerate(), ilChatroomInfoTaskTest\testExecuteDefault(), ilChatroomTaskHandlerTest\testExitIfNoRoomPermissionFails(), ilChatroomTaskHandlerTest\testExitIfNoRoomPermissionSuccess(), and ilChatroomTaskHandlerTest\testRedirectIfNoPermission().

70  {
71  if($times == null)
72  {
73  $times = $this->any();
74  }
75 
76  return $GLOBALS['rbacsystem']->expects($times)->method('checkAccess')->with($this->equalTo($permission))->will(
77  $this->returnValue($result)
78  );
79  }
$result
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
+ Here is the caller graph for this function:

◆ createGlobalRbacSystemMock()

ilChatroomAbstractTaskTest::createGlobalRbacSystemMock ( )
protected

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

References $GLOBALS, and array.

Referenced by ilChatroomTaskHandlerTest\setUp(), ilChatroomInfoTaskTest\setUp(), and ilChatroomClearTaskTest\setUp().

55  {
56  require_once './Services/AccessControl/classes/class.ilRbacSystem.php';
57  $GLOBALS['rbacsystem'] = $this->getMockBuilder('ilRbacSystem')->disableOriginalConstructor()->setMethods(
58  array('checkAccess')
59  )->getMock();
60 
61  return $GLOBALS['rbacsystem'];
62  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ createIlChatroomIsOwnerOfPrivateRoomMock()

ilChatroomAbstractTaskTest::createIlChatroomIsOwnerOfPrivateRoomMock (   $userId,
  $subRoomId,
  $result 
)
protected
Parameters
int$userId
int$subRoomId
boolean$result
Returns
PHPUnit_Framework_MockObject_MockObject

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

References $result.

Referenced by ilChatroomTaskHandlerTest\testCanModerate(), ilChatroomTaskHandlerTest\testExitIfNoRoomPermissionFails(), and ilChatroomTaskHandlerTest\testExitIfNoRoomPermissionSuccess().

130  {
131  return $this->ilChatroomMock->expects($this->at(0))->method('isOwnerOfPrivateRoom')->with(
132  $this->equalTo($userId),
133  $this->equalTo($subRoomId)
134  )->will($this->returnValue($result));
135  }
$result
+ Here is the caller graph for this function:

◆ createIlChatroomServerConnectorFileGetContentsMock()

ilChatroomAbstractTaskTest::createIlChatroomServerConnectorFileGetContentsMock (   $returnValue)
protected

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

Referenced by ilChatroomClearTaskTest\setUp().

158  {
159  return $this->ilChatroomServerConnectorMock->expects($this->any())->method('file_get_contents')->will(
160  $this->returnValue($returnValue)
161  );
162  }
Class ilChatroomServerConnectorMock.
+ Here is the caller graph for this function:

◆ createIlChatroomServerConnectorMock()

ilChatroomAbstractTaskTest::createIlChatroomServerConnectorMock (   $settings)
protected
Parameters
ilChatroomServerSettings$settings
Returns
ilChatroomServerConnector|PHPUnit_Framework_MockObject_MockObject

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

References $ilChatroomServerConnectorMock, and array.

Referenced by ilChatroomClearTaskTest\setUp().

147  {
148  require_once './Modules/Chatroom/classes/class.ilChatroomServerConnector.php';
149 
150  $this->ilChatroomServerConnectorMock = $this->getMockBuilder('ilChatroomServerConnector')->setConstructorArgs(
151  array($settings)
152  )->setMethods(array('file_get_contents'))->getMock();
153 
155  }
Create styles array
The data for the language used.
Class ilChatroomServerConnectorMock.
+ Here is the caller graph for this function:

◆ createIlChatroomUserGetUserIdMock()

ilChatroomAbstractTaskTest::createIlChatroomUserGetUserIdMock (   $userId)
protected

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

Referenced by ilChatroomTaskHandlerTest\testExitIfNoRoomPermissionFails(), and ilChatroomTaskHandlerTest\testExitIfNoRoomPermissionSuccess().

138  {
139  return $this->ilChatroomUserMock->expects($this->any())->method('getUserId')->will($this->returnValue($userId));
140  }
+ Here is the caller graph for this function:

◆ createIlObjChatroomGUIGetConnectorMock()

ilChatroomAbstractTaskTest::createIlObjChatroomGUIGetConnectorMock (   $returnValue)
protected

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

Referenced by ilChatroomClearTaskTest\setUp().

119  {
120  $this->gui->expects($this->any())->method('getConnector')->will($this->returnValue($returnValue));
121  }
+ Here is the caller graph for this function:

◆ createIlObjChatroomGUIMock()

ilChatroomAbstractTaskTest::createIlObjChatroomGUIMock (   $object)
protected

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

References $gui, $object, and array.

Referenced by ilChatroomUploadFileTaskTest\setUp(), ilChatroomPostMessageTaskTest\setUp(), ilChatroomGetPermissionsTaskTest\setUp(), ilChatroomInitialTaskTest\setUp(), ilChatroomInfoTaskTest\setUp(), ilChatroomTaskHandlerTest\setUp(), and ilChatroomClearTaskTest\setUp().

106  {
107  require_once './Modules/Chatroom/classes/class.ilObjChatroomGUI.php';
108 
109  $this->gui = $this->getMockBuilder('ilObjChatroomGUI')->disableOriginalConstructor()->disableArgumentCloning()->setMethods(
110  array('getRefId', 'getConnector', 'switchToVisibleMode')
111  )->getMock();
112  $this->gui->ref_id = self::TEST_REF_ID;
113  $this->gui->object = $object;
114 
115  return $this->gui;
116  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ createIlObjChatroomMock()

ilChatroomAbstractTaskTest::createIlObjChatroomMock (   $id)
protected

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

References $object, and array.

Referenced by ilChatroomUploadFileTaskTest\setUp(), ilChatroomPostMessageTaskTest\setUp(), ilChatroomGetPermissionsTaskTest\setUp(), ilChatroomInitialTaskTest\setUp(), ilChatroomInfoTaskTest\setUp(), ilChatroomTaskHandlerTest\setUp(), and ilChatroomClearTaskTest\setUp().

165  {
166  require_once './Modules/Chatroom/classes/class.ilObjChatroom.php';
167 
168  $this->object = $this->getMockBuilder('ilObjChatroom')->disableOriginalConstructor()->setMethods(
169  array('getId')
170  )->getMock();
171  $this->object->expects($this->any())->method('getId')->will($this->returnValue($id));
172 
173  return $this->object;
174  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ createSendResponseMock()

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

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

Referenced by ilChatroomClearTaskTest\testExecuteDefault(), and ilChatroomClearTaskTest\testExecuteDefaultFailedNoRoomExists().

177  {
178  $mock->expects($this->once())->method('sendResponse')->with(
179  $this->equalTo($response)
180  )->will(
181  $this->returnCallback(
182  function ()
183  {
184  throw new Exception('Exit', 0);
185  }
186  )
187  );
188  }
+ Here is the caller graph for this function:

◆ setUp()

ilChatroomAbstractTaskTest::setUp ( )
protected

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

References defined, and time.

32  {
33  parent::setUp();
34 
35  if(!defined('ROOT_FOLDER_ID'))
36  {
37  define('ROOT_FOLDER_ID', time());
38  }
39  }
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27

Field Documentation

◆ $gui

ilChatroomAbstractTaskTest::$gui
protected

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

Referenced by createIlObjChatroomGUIMock().

◆ $ilChatroomServerConnectorMock

ilChatroomAbstractTaskTest::$ilChatroomServerConnectorMock
protected

◆ $object

ilChatroomAbstractTaskTest::$object
protected

◆ TEST_REF_ID

const ilChatroomAbstractTaskTest::TEST_REF_ID = 99

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


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