ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilObjChatroomTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
26 {
28 
29  public function testPersonalInformationCanBeRetrieved(): void
30  {
31  $this->ilChatroomUserMock->expects($this->once())->method('getUserId')->willReturn(6);
32  $this->ilChatroomUserMock->expects($this->once())->method('getUsername')->willReturn('username');
33 
34  $userInfo = $this->object->getPersonalInformation($this->ilChatroomUserMock);
35 
36  $this->assertInstanceOf(stdClass::class, $userInfo);
37  $this->assertSame('username', $userInfo->username);
38  $this->assertSame(6, $userInfo->id);
39  }
40 
41  public function testPublicRoomObjIdCanBeRetrieved(): void
42  {
43  $db = $this->createGlobalIlDBMock();
44 
45  $db->expects($this->once())->method('fetchAssoc')->willReturn(['object_id' => '6']);
46 
47  $this->assertSame(6, $this->object::_getPublicObjId());
48  }
49 
51  {
52  $db = $this->createGlobalIlDBMock();
53 
54  $db->expects($this->once())->method('fetchAssoc')->willReturn(null);
55 
56  $this->assertSame(0, $this->object::_getPublicObjId());
57  }
58 
59  protected function setUp(): void
60  {
61  parent::setUp();
62 
63  $this->createIlChatroomUserMock();
64 
65  $this->object = (new ReflectionClass(ilObjChatroom::class))->newInstanceWithoutConstructor();
66  }
67 }
Class ilChatroomAbstractTest.
Class ilObjChatroomTest.