ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 79 of file class.ilChatroomAbstractTaskTest.php.

References $GLOBALS, and array.

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

80  {
81  require_once './Services/UICore/classes/class.ilCtrl.php';
82 
83  $GLOBALS['ilCtrl'] = $this->getMockBuilder('ilCtrl')->disableOriginalConstructor()->setMethods(
84  array('setParameterByClass', 'redirectByClass', 'forwardCommand')
85  )->getMock();
86  $GLOBALS['ilCtrl']->expects($this->any())->method('setParameterByClass');
87  $GLOBALS['ilCtrl']->expects($this->any())->method('redirectByClass');
88 
89  return $GLOBALS['ilCtrl'];
90  }
$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 40 of file class.ilChatroomAbstractTaskTest.php.

References $GLOBALS, and array.

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

41  {
42  require_once './Services/Language/classes/class.ilLanguage.php';
43  $GLOBALS['lng'] = $this->getMockBuilder('ilLanguage')->disableOriginalConstructor()->setMethods(
44  array('loadLanguageModule', 'txt')
45  )->getMock();
46 
47  $GLOBALS['lng']->expects($this->any())->method('loadLanguageModule')->with($this->logicalOr($this->equalTo('chatroom'), $this->equalTo('meta')));
48  $GLOBALS['lng']->expects($this->any())->method('txt');
49 
50  return $GLOBALS['lng'];
51  }
$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 92 of file class.ilChatroomAbstractTaskTest.php.

References $GLOBALS, and array.

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

93  {
94  require_once 'Services/User/classes/class.ilObjUser.php';
95 
96  $GLOBALS['ilUser'] = $this->getMockBuilder('ilObjUser')->disableOriginalConstructor()->setMethods(
97  array()
98  )->getMock();
99 
100  return $GLOBALS['ilUser'];
101  }
$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 68 of file class.ilChatroomAbstractTaskTest.php.

References $GLOBALS, and $result.

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

69  {
70  if ($times == null) {
71  $times = $this->any();
72  }
73 
74  return $GLOBALS['rbacsystem']->expects($times)->method('checkAccess')->with($this->equalTo($permission))->will(
75  $this->returnValue($result)
76  );
77  }
$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 53 of file class.ilChatroomAbstractTaskTest.php.

References $GLOBALS, and array.

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

54  {
55  require_once './Services/AccessControl/classes/class.ilRbacSystem.php';
56  $GLOBALS['rbacsystem'] = $this->getMockBuilder('ilRbacSystem')->disableOriginalConstructor()->setMethods(
57  array('checkAccess')
58  )->getMock();
59 
60  return $GLOBALS['rbacsystem'];
61  }
$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 127 of file class.ilChatroomAbstractTaskTest.php.

References $result.

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

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

◆ createIlChatroomServerConnectorFileGetContentsMock()

ilChatroomAbstractTaskTest::createIlChatroomServerConnectorFileGetContentsMock (   $returnValue)
protected

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

Referenced by ilChatroomClearTaskTest\setUp().

156  {
157  return $this->ilChatroomServerConnectorMock->expects($this->any())->method('file_get_contents')->will(
158  $this->returnValue($returnValue)
159  );
160  }
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 144 of file class.ilChatroomAbstractTaskTest.php.

References $ilChatroomServerConnectorMock, and array.

Referenced by ilChatroomClearTaskTest\setUp().

145  {
146  require_once './Modules/Chatroom/classes/class.ilChatroomServerConnector.php';
147 
148  $this->ilChatroomServerConnectorMock = $this->getMockBuilder('ilChatroomServerConnector')->setConstructorArgs(
149  array($settings)
150  )->setMethods(array('file_get_contents'))->getMock();
151 
153  }
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 135 of file class.ilChatroomAbstractTaskTest.php.

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

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

◆ createIlObjChatroomGUIGetConnectorMock()

ilChatroomAbstractTaskTest::createIlObjChatroomGUIGetConnectorMock (   $returnValue)
protected

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

Referenced by ilChatroomClearTaskTest\setUp().

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

◆ createIlObjChatroomGUIMock()

ilChatroomAbstractTaskTest::createIlObjChatroomGUIMock (   $object)
protected

Definition at line 103 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().

104  {
105  require_once './Modules/Chatroom/classes/class.ilObjChatroomGUI.php';
106 
107  $this->gui = $this->getMockBuilder('ilObjChatroomGUI')->disableOriginalConstructor()->disableArgumentCloning()->setMethods(
108  array('getRefId', 'getConnector', 'switchToVisibleMode')
109  )->getMock();
110  $this->gui->ref_id = self::TEST_REF_ID;
111  $this->gui->object = $object;
112 
113  return $this->gui;
114  }
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 162 of file class.ilChatroomAbstractTaskTest.php.

References $id, $object, and array.

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

163  {
164  require_once './Modules/Chatroom/classes/class.ilObjChatroom.php';
165 
166  $this->object = $this->getMockBuilder('ilObjChatroom')->disableOriginalConstructor()->setMethods(
167  array('getId')
168  )->getMock();
169  $this->object->expects($this->any())->method('getId')->will($this->returnValue($id));
170 
171  return $this->object;
172  }
if(!array_key_exists('StateId', $_REQUEST)) $id
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 174 of file class.ilChatroomAbstractTaskTest.php.

References $response.

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

175  {
176  $mock->expects($this->once())->method('sendResponse')->with(
177  $this->equalTo($response)
178  )->will(
179  $this->returnCallback(
180  function () {
181  throw new Exception('Exit', 0);
182  }
183  )
184  );
185  }
$response
+ 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  define('ROOT_FOLDER_ID', time());
37  }
38  }
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: