ILIAS  release_8 Revision v8.23
ilChatroomAbstractTest Class Reference

Class ilChatroomAbstractTest. More...

+ Inheritance diagram for ilChatroomAbstractTest:
+ Collaboration diagram for ilChatroomAbstractTest:

Protected Member Functions

 setUp ()
 
 tearDown ()
 
 createIlChatroomMock ()
 
 createIlChatroomUserMock ()
 
 createGlobalIlDBMock ()
 
 setGlobalVariable (string $name, $value)
 

Protected Attributes

 $ilChatroomMock
 
 $ilChatroomUserMock
 

Private Attributes

Container $dic = null
 

Detailed Description

Member Function Documentation

◆ createGlobalIlDBMock()

ilChatroomAbstractTest::createGlobalIlDBMock ( )
protected
Returns
ilDBInterface&MockObject

Definition at line 89 of file class.ilChatroomAbstractTest.php.

References setGlobalVariable().

Referenced by ilObjChatroomAccessTest\setUp(), ilObjChatroomTest\testPublicRoomObjIdCanBeRetrieved(), and ilObjChatroomTest\testPublicRoomObjIdDefaultValueCanBeRetrieved().

90  {
91  $db = $this->getMockBuilder(ilDBInterface::class)->getMock();
92  $db->method('quote')->willReturnCallback(static function ($arg): string {
93  return "'" . $arg . "'";
94  });
95 
96  $this->setGlobalVariable('ilDB', $db);
97 
98  return $db;
99  }
setGlobalVariable(string $name, $value)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createIlChatroomMock()

ilChatroomAbstractTest::createIlChatroomMock ( )
protected
Returns
ilChatroom&MockObject

Definition at line 65 of file class.ilChatroomAbstractTest.php.

References $ilChatroomMock.

65  : ilChatroom
66  {
67  $this->ilChatroomMock = $this->getMockBuilder(ilChatroom::class)->disableOriginalConstructor()->onlyMethods(
68  ['isOwnerOfPrivateRoom', 'clearMessages']
69  )->getMock();
70 
71  return $this->ilChatroomMock;
72  }
Class ilChatroom.

◆ createIlChatroomUserMock()

ilChatroomAbstractTest::createIlChatroomUserMock ( )
protected
Returns
ilChatroomUser&MockObject

Definition at line 77 of file class.ilChatroomAbstractTest.php.

References $ilChatroomUserMock.

Referenced by ilObjChatroomTest\setUp().

78  {
79  $this->ilChatroomUserMock = $this->getMockBuilder(ilChatroomUser::class)->disableOriginalConstructor()->onlyMethods(
80  ['getUserId', 'getUsername']
81  )->getMock();
82 
84  }
Class ilChatroomUser.
+ Here is the caller graph for this function:

◆ setGlobalVariable()

ilChatroomAbstractTest::setGlobalVariable ( string  $name,
  $value 
)
protected

Definition at line 101 of file class.ilChatroomAbstractTest.php.

References $c, $DIC, $GLOBALS, and $name.

Referenced by ilChatroomAbstractTaskTest\createGlobalIlCtrlMock(), createGlobalIlDBMock(), ilChatroomAbstractTaskTest\createGlobalIlLanguageMock(), ilChatroomAbstractTaskTest\createGlobalIlUserMock(), ilChatroomAbstractTaskTest\createGlobalRbacSystemMock(), setUp(), ilObjChatroomAdminAccessTest\setUp(), ilObjChatroomAccessTest\testAccessChecksFail(), ilObjChatroomAccessTest\testAccessChecksSucceed(), ilObjChatroomAccessTest\testGotoCheckFails(), and ilObjChatroomAccessTest\testGotoCheckSucceeds().

101  : void
102  {
103  global $DIC;
104 
105  $GLOBALS[$name] = $value;
106 
107  $DIC[$name] = static function (Container $c) use ($name) {
108  return $GLOBALS[$name];
109  };
110  }
$c
Definition: cli.php:38
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31
global $DIC
Definition: feed.php:28
if($format !==null) $name
Definition: metadata.php:247
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the caller graph for this function:

◆ setUp()

ilChatroomAbstractTest::setUp ( )
protected

Definition at line 37 of file class.ilChatroomAbstractTest.php.

References $DIC, and setGlobalVariable().

37  : void
38  {
39  global $DIC;
40 
41  $this->dic = is_object($DIC) ? clone $DIC : $DIC;
42 
43  $DIC = new Container();
44 
45  $this->setGlobalVariable(
46  'tpl',
47  $this->getMockBuilder(ilGlobalTemplateInterface::class)->getMock()
48  );
49 
50  parent::setUp();
51  }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31
global $DIC
Definition: feed.php:28
setGlobalVariable(string $name, $value)
+ Here is the call graph for this function:

◆ tearDown()

ilChatroomAbstractTest::tearDown ( )
protected

Definition at line 53 of file class.ilChatroomAbstractTest.php.

References $DIC, and $dic.

53  : void
54  {
55  global $DIC;
56 
57  $DIC = $this->dic;
58 
59  parent::tearDown();
60  }
global $DIC
Definition: feed.php:28

Field Documentation

◆ $dic

Container ilChatroomAbstractTest::$dic = null
private

Definition at line 35 of file class.ilChatroomAbstractTest.php.

Referenced by tearDown().

◆ $ilChatroomMock

ilChatroomAbstractTest::$ilChatroomMock
protected

Definition at line 32 of file class.ilChatroomAbstractTest.php.

Referenced by createIlChatroomMock().

◆ $ilChatroomUserMock

ilChatroomAbstractTest::$ilChatroomUserMock
protected

Definition at line 34 of file class.ilChatroomAbstractTest.php.

Referenced by createIlChatroomUserMock().


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