ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilObjChatroomTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
24
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
60
61 $this->object = (new ReflectionClass(ilObjChatroom::class))->newInstanceWithoutConstructor();
62 }
63}
ilObjChatroom $object
testPublicRoomObjIdDefaultValueCanBeRetrieved()