ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ilObjChatroomTest Class Reference
+ Inheritance diagram for ilObjChatroomTest:
+ Collaboration diagram for ilObjChatroomTest:

Public Member Functions

 testPersonalInformationCanBeRetrieved ()
 
 testPublicRoomObjIdCanBeRetrieved ()
 
 testPublicRoomObjIdDefaultValueCanBeRetrieved ()
 

Protected Member Functions

 setUp ()
 
- Protected Member Functions inherited from ilChatroomAbstractTestBase
 setUp ()
 
 tearDown ()
 
 createIlChatroomUserMock ()
 
 createGlobalIlDBMock ()
 
 setGlobalVariable (string $name, $value)
 

Protected Attributes

ilObjChatroom $object
 
- Protected Attributes inherited from ilChatroomAbstractTestBase
MockObject &ilChatroom $ilChatroomMock
 
MockObject &ilChatroomUser $ilChatroomUserMock
 

Detailed Description

Definition at line 21 of file ilObjChatroomTest.php.

Member Function Documentation

◆ setUp()

ilObjChatroomTest::setUp ( )
protected

Definition at line 55 of file ilObjChatroomTest.php.

References ilChatroomAbstractTestBase\createIlChatroomUserMock().

55  : void
56  {
57  parent::setUp();
58 
59  $this->createIlChatroomUserMock();
60 
61  $this->object = (new ReflectionClass(ilObjChatroom::class))->newInstanceWithoutConstructor();
62  }
+ Here is the call graph for this function:

◆ testPersonalInformationCanBeRetrieved()

ilObjChatroomTest::testPersonalInformationCanBeRetrieved ( )

Definition at line 25 of file ilObjChatroomTest.php.

25  : void
26  {
27  $this->ilChatroomUserMock->expects($this->once())->method('getUserId')->willReturn(6);
28  $this->ilChatroomUserMock->expects($this->once())->method('getUsername')->willReturn('username');
29 
30  $userInfo = $this->object->getPersonalInformation($this->ilChatroomUserMock);
31 
32  $this->assertInstanceOf(stdClass::class, $userInfo);
33  $this->assertSame('username', $userInfo->username);
34  $this->assertSame(6, $userInfo->id);
35  }

◆ testPublicRoomObjIdCanBeRetrieved()

ilObjChatroomTest::testPublicRoomObjIdCanBeRetrieved ( )

Definition at line 37 of file ilObjChatroomTest.php.

References ilChatroomAbstractTestBase\createGlobalIlDBMock().

37  : void
38  {
39  $db = $this->createGlobalIlDBMock();
40 
41  $db->expects($this->once())->method('fetchAssoc')->willReturn(['object_id' => '6']);
42 
43  $this->assertSame(6, $this->object::_getPublicObjId());
44  }
+ Here is the call graph for this function:

◆ testPublicRoomObjIdDefaultValueCanBeRetrieved()

ilObjChatroomTest::testPublicRoomObjIdDefaultValueCanBeRetrieved ( )

Definition at line 46 of file ilObjChatroomTest.php.

References ilChatroomAbstractTestBase\createGlobalIlDBMock(), and null.

46  : void
47  {
48  $db = $this->createGlobalIlDBMock();
49 
50  $db->expects($this->once())->method('fetchAssoc')->willReturn(null);
51 
52  $this->assertSame(0, $this->object::_getPublicObjId());
53  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

Field Documentation

◆ $object

ilObjChatroom ilObjChatroomTest::$object
protected

Definition at line 23 of file ilObjChatroomTest.php.


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