ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilObjChatroomTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 {
24 
25  public function testPersonalInformationCanBeRetrieved(): 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  }
36 
37  public function testPublicRoomObjIdCanBeRetrieved(): 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  }
45 
47  {
48  $db = $this->createGlobalIlDBMock();
49 
50  $db->expects($this->once())->method('fetchAssoc')->willReturn(null);
51 
52  $this->assertSame(0, $this->object::_getPublicObjId());
53  }
54 
55  protected function setUp(): void
56  {
57  parent::setUp();
58 
59  $this->createIlChatroomUserMock();
60 
61  $this->object = (new ReflectionClass(ilObjChatroom::class))->newInstanceWithoutConstructor();
62  }
63 }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
testPublicRoomObjIdDefaultValueCanBeRetrieved()
ilObjChatroom $object