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

Class ilChatroomClearTask. More...

+ Inheritance diagram for ilChatroomClearTaskTest:
+ Collaboration diagram for ilChatroomClearTaskTest:

Public Member Functions

 testExecuteDefault ()
 
 testExecuteDefaultFailedPermission ()
 
 testExecuteDefaultFailedNoRoomExists ()
 

Protected Member Functions

 setUp ()
 
- Protected Member Functions inherited from ilChatroomAbstractTaskTest
 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

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

Additional Inherited Members

- Data Fields inherited from ilChatroomAbstractTaskTest
const TEST_REF_ID = 99
 

Detailed Description

Class ilChatroomClearTask.

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

Definition at line 9 of file class.ilChatroomClearTaskTest.php.

Member Function Documentation

◆ setUp()

ilChatroomClearTaskTest::setUp ( )
protected

Definition at line 17 of file class.ilChatroomClearTaskTest.php.

References array, ilChatroomAbstractTaskTest\createGlobalIlCtrlMock(), ilChatroomAbstractTaskTest\createGlobalIlLanguageMock(), ilChatroomAbstractTaskTest\createGlobalIlUserMock(), ilChatroomAbstractTaskTest\createGlobalRbacSystemMock(), ilChatroomAbstractTaskTest\createIlChatroomServerConnectorFileGetContentsMock(), ilChatroomAbstractTaskTest\createIlChatroomServerConnectorMock(), ilChatroomAbstractTaskTest\createIlObjChatroomGUIGetConnectorMock(), ilChatroomAbstractTaskTest\createIlObjChatroomGUIMock(), and ilChatroomAbstractTaskTest\createIlObjChatroomMock().

18  {
19  parent::setUp();
20 
21  require_once './Modules/Chatroom/classes/gui/class.ilChatroomClearGUI.php';
22  require_once './Modules/Chatroom/classes/class.ilChatroomServerSettings.php';
23 
24  $settings = new ilChatroomServerSettings();
25 
26  $this->createGlobalIlUserMock();
27  $this->createGlobalIlCtrlMock();
30  $this->createilChatroomMock();
31  $this->createIlChatroomServerConnectorMock($settings);
33  $this->createIlObjChatroomMock(15);
34  $this->createIlObjChatroomGUIMock($this->object);
36 
37  $this->task = $this->getMock(
38  'ilChatroomClearGUI',
39  array('sendResponse', 'getRoomByObjectId', 'redirectIfNoPermission'),
40  array($this->gui)
41  );
42  }
Create styles array
The data for the language used.
Class ilChatroomServerSettings.
Class ilChatroomServerConnectorMock.
+ Here is the call graph for this function:

◆ testExecuteDefault()

ilChatroomClearTaskTest::testExecuteDefault ( )

Definition at line 44 of file class.ilChatroomClearTaskTest.php.

References array, and ilChatroomAbstractTaskTest\createSendResponseMock().

45  {
46  $_REQUEST['sub'] = 0;
47 
48  $this->task->expects($this->once())->method('redirectIfNoPermission')->with(
49  $this->equalTo('moderate')
50  );
51  $this->task->expects($this->any())->method('getRoomByObjectId')->will(
52  $this->returnValue($this->ilChatroomMock)
53  );
54  $this->createSendResponseMock($this->task, array(
55  'success' => true,
56  ));
57 
58  $this->setExpectedException('Exception', 'Exit', 0);
59  $this->task->executeDefault(null);
60  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ testExecuteDefaultFailedNoRoomExists()

ilChatroomClearTaskTest::testExecuteDefaultFailedNoRoomExists ( )

Definition at line 75 of file class.ilChatroomClearTaskTest.php.

References array, and ilChatroomAbstractTaskTest\createSendResponseMock().

76  {
77  $_REQUEST['sub'] = 0;
78 
79  $this->task->expects($this->once())->method('redirectIfNoPermission')->with(
80  $this->equalTo('moderate')
81  );
82  $this->task->expects($this->any())->method('getRoomByObjectId')->will(
83  $this->returnValue(null)
84  );
85  $this->createSendResponseMock($this->task, array(
86  'success' => false,
87  'reason' => 'unkown room',
88  ));
89 
90  $this->setExpectedException('Exception', 'Exit', 0);
91  $this->task->executeDefault(null);
92  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ testExecuteDefaultFailedPermission()

ilChatroomClearTaskTest::testExecuteDefaultFailedPermission ( )

Definition at line 62 of file class.ilChatroomClearTaskTest.php.

63  {
64  $_REQUEST['sub'] = 0;
65 
66  $this->task->expects($this->once())->method('redirectIfNoPermission')->with('moderate')->will($this->returnCallback(function ()
67  {
68  throw new Exception('Weak redirect on no Permission. Send just failure message instead', 1456351768);
69  }));
70 
71  $this->setExpectedException('Exception', "", 1456351768);
72  $this->task->executeDefault(null);
73  }

Field Documentation

◆ $task

ilChatroomClearTaskTest::$task
protected

Definition at line 15 of file class.ilChatroomClearTaskTest.php.


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