ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilChatroomInfoTaskTest.php
Go to the documentation of this file.
1 <?php
2 
3 require_once dirname(__FILE__) . '/../class.ilChatroomAbstractTaskTest.php';
4 
10 {
11 
15  protected $task;
16 
17  protected function setUp()
18  {
19  parent::setUp();
20 
21  if (!defined('DB_FETCHMODE_OBJECT')) {
22  define('DB_FETCHMODE_OBJECT', 'ASSOC');
23  }
24 
25  require_once './Modules/Chatroom/classes/gui/class.ilChatroomInfoGUI.php';
26 
27  $this->createGlobalIlCtrlMock();
30  $this->createGlobalIlDBMock();
31  $this->createIlObjChatroomMock(15);
32  $this->createIlObjChatroomGUIMock($this->object);
33 
34  $this->task = $this->createMock(
35  'ilChatroomInfoGUI',
36  array('sendResponse', 'getRoomByObjectId', 'redirectIfNoPermission', 'createInfoScreenGUI'),
37  array($this->gui)
38  );
39  }
40 
41  public function testExecuteDefault()
42  {
43  $_GET['ref_id'] = 99; // if not set causes error of undefined index
44 
45  require_once './Services/InfoScreen/classes/class.ilInfoScreenGUI.php';
46  $infoScreenMock = $this->createMock('ilInfoScreenGUI', array('addMetaDataSections'), array($this->gui));
47  $infoScreenMock->expects($this->any())->method('addMetaDataSections')->with(
48  $this->equalTo(15),
49  0,
50  null
51  );
52 
53  $this->task->expects($this->any())->method('redirectIfNoPermission')->with(
54  $this->equalTo('view')
55  );
56  $this->task->expects($this->any())->method('getRoomByObjectId')->will(
57  $this->returnValue($this->ilChatroomMock)
58  );
59  $this->task->expects($this->any())->method('createInfoScreenGUI')->will(
60  $this->returnValue($infoScreenMock)
61  );
62  $GLOBALS['ilCtrl']->expects($this->atLeastOnce())->method('forwardCommand');
63 
64  $this->createGlobalRbacSystemCheckAccessMock('visible', true, $this->at(0)); // Suppress raiseError
65  $this->createGlobalRbacSystemCheckAccessMock('read', true, $this->at(1)); // Enables News
66  $this->task->executeDefault(null);
67 
68  $this->createGlobalRbacSystemCheckAccessMock('visible', true, $this->at(0)); // raiseError
69  $this->createGlobalRbacSystemCheckAccessMock('read', true, $this->at(1)); // Enables News
70  $this->task->executeDefault('method');
71  }
72 }
$_GET["client_id"]
Class ilChatroomAbstractTaskTest.
createGlobalRbacSystemCheckAccessMock($permission, $result, $times=null)
Class ilChatroomInfoTaskTest.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.