ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilObjChatroomTest Class Reference

Class ilObjChatroomTest. More...

+ Inheritance diagram for ilObjChatroomTest:
+ Collaboration diagram for ilObjChatroomTest:

Public Member Functions

 testConstructor ()
 
 testGetPersonalInformation ()
 
 test_GetPublicRefId ()
 
 test_GetPublicObjId ()
 
 test_GetPublicObjIdDefaultValue ()
 
 testInitDefaultRoles ()
 

Protected Member Functions

 setUp ()
 
- Protected Member Functions inherited from ilChatroomAbstractTest
 setUp ()
 
 createIlChatroomMock ()
 
 createIlChatroomUserMock ()
 
 createGlobalIlDBMock ()
 

Protected Attributes

 $object
 
- Protected Attributes inherited from ilChatroomAbstractTest
 $ilChatroomMock
 
 $ilChatroomUserMock
 

Detailed Description

Class ilObjChatroomTest.

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

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

Member Function Documentation

◆ setUp()

ilObjChatroomTest::setUp ( )
protected

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

References array, and ilChatroomAbstractTest\createIlChatroomUserMock().

18  {
19  parent::setUp(); // TODO: Change the autogenerated stub
20 
21  require_once './Modules/Chatroom/classes/class.ilObjChatroom.php';
22 
23  $this->createIlChatroomUserMock();
24 
25  $this->object = $this->createMock(
26  'ilObjChatroom',
27  array('createDefaultRole')
28  );
29  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ test_GetPublicObjId()

ilObjChatroomTest::test_GetPublicObjId ( )

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

References $GLOBALS, $query, array, ilChatroomAbstractTest\createGlobalIlDBMock(), and object.

54  {
55  $this->createGlobalIlDBMock();
56 
57  $query = 'SELECT object_id FROM chatroom_settings WHERE room_type=default';
58  $GLOBALS['ilDB']->expects($this->once())->method('query')->with($this->equalTo($query));
59  $GLOBALS['ilDB']->expects($this->once())->method('quote')->with($this->equalTo('default'))->will($this->returnValue('default'));
60  $GLOBALS['ilDB']->expects($this->once())->method('fetchAssoc')->will($this->returnValue(array('object_id' => '6')));
61 
62  $this->assertEquals(6, $this->object->_getPublicObjId());
63  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$query
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ test_GetPublicObjIdDefaultValue()

ilObjChatroomTest::test_GetPublicObjIdDefaultValue ( )

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

References $GLOBALS, $query, ilChatroomAbstractTest\createGlobalIlDBMock(), and object.

66  {
67  $this->createGlobalIlDBMock();
68 
69  $query = 'SELECT object_id FROM chatroom_settings WHERE room_type=default';
70  $GLOBALS['ilDB']->expects($this->once())->method('query')->with($this->equalTo($query));
71  $GLOBALS['ilDB']->expects($this->once())->method('quote')->with($this->equalTo('default'))->will($this->returnValue('default'));
72  $GLOBALS['ilDB']->expects($this->once())->method('fetchAssoc')->will($this->returnValue(null));
73 
74  $this->assertEquals(0, $this->object->_getPublicObjId());
75  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$query
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ test_GetPublicRefId()

ilObjChatroomTest::test_GetPublicRefId ( )

Definition at line 48 of file class.ilObjChatroomTest.php.

References object.

49  {
50  $this->assertEquals(0, $this->object->_getPublicRefId());
51  }
Create new PHPExcel object
obj_idprivate

◆ testConstructor()

ilObjChatroomTest::testConstructor ( )

Definition at line 31 of file class.ilObjChatroomTest.php.

32  {
33  $this->assertInstanceOf('ilObjChatroom', $this->object);
34  }

◆ testGetPersonalInformation()

ilObjChatroomTest::testGetPersonalInformation ( )

Definition at line 36 of file class.ilObjChatroomTest.php.

37  {
38  $this->ilChatroomUserMock->expects($this->once())->method('getUserId')->will($this->returnValue(6));
39  $this->ilChatroomUserMock->expects($this->once())->method('getUsername')->will($this->returnValue('username'));
40 
41  $userInfo = $this->object->getPersonalInformation($this->ilChatroomUserMock);
42 
43  $this->assertInstanceOf('stdClass', $userInfo);
44  $this->assertEquals('username', $userInfo->username);
45  $this->assertEquals(6, $userInfo->id);
46  }

◆ testInitDefaultRoles()

ilObjChatroomTest::testInitDefaultRoles ( )

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

References object.

78  {
79  //include_once './Services/AccessControl/classes/class.ilObjRole.php';
80  $this->backupStaticAttributes = true;
81  $this->object->expects($this->once())->method('createDefaultRole');
82  $this->assertEmpty($this->object->initDefaultRoles());
83  }
Create new PHPExcel object
obj_idprivate

Field Documentation

◆ $object

ilObjChatroomTest::$object
protected

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


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