ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
23  define('DB_FETCHMODE_OBJECT', 'ASSOC');
24  }
25 
26  require_once './Modules/Chatroom/classes/gui/class.ilChatroomInfoGUI.php';
27 
28  $this->createGlobalIlCtrlMock();
31  $this->createGlobalIlDBMock();
32  $this->createIlObjChatroomMock(15);
33  $this->createIlObjChatroomGUIMock($this->object);
34 
35  $this->task = $this->getMock(
36  'ilChatroomInfoGUI',
37  array('sendResponse', 'getRoomByObjectId', 'redirectIfNoPermission', 'createInfoScreenGUI'),
38  array($this->gui)
39  );
40  }
41 
42  public function testExecuteDefault()
43  {
44  $_GET['ref_id'] = 99; // if not set causes error of undefined index
45 
46  require_once './Services/InfoScreen/classes/class.ilInfoScreenGUI.php';
47  $infoScreenMock = $this->getMock('ilInfoScreenGUI', array('addMetaDataSections'), array($this->gui));
48  $infoScreenMock->expects($this->any())->method('addMetaDataSections')->with(
49  $this->equalTo(15), 0, null
50  );
51 
52  $this->task->expects($this->any())->method('redirectIfNoPermission')->with(
53  $this->equalTo('view')
54  );
55  $this->task->expects($this->any())->method('getRoomByObjectId')->will(
56  $this->returnValue($this->ilChatroomMock)
57  );
58  $this->task->expects($this->any())->method('createInfoScreenGUI')->will(
59  $this->returnValue($infoScreenMock)
60  );
61  $GLOBALS['ilCtrl']->expects($this->atLeastOnce())->method('forwardCommand');
62 
63  $this->createGlobalRbacSystemCheckAccessMock('visible', true, $this->at(0)); // Suppress raiseError
64  $this->createGlobalRbacSystemCheckAccessMock('read', true, $this->at(1)); // Enables News
65  $this->task->executeDefault(null);
66 
67  $this->createGlobalRbacSystemCheckAccessMock('visible', true, $this->at(0)); // raiseError
68  $this->createGlobalRbacSystemCheckAccessMock('read', true, $this->at(1)); // Enables News
69  $this->task->executeDefault('method');
70  }
71 
72 }
$_GET["client_id"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Class ilChatroomAbstractTaskTest.
createGlobalRbacSystemCheckAccessMock($permission, $result, $times=null)
Create styles array
The data for the language used.
Class ilChatroomInfoTaskTest.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27