19declare(strict_types=1);
21use PHPUnit\Framework\MockObject\Builder\InvocationMocker;
22use PHPUnit\Framework\MockObject\MockObject;
23use PHPUnit\Framework\MockObject\Rule\InvocationOrder;
31 protected function setUp(): void
35 if (!defined(
'ROOT_FOLDER_ID')) {
36 define(
'ROOT_FOLDER_ID', time());
42 $lng = $this->getMockBuilder(ilLanguage::class)->disableOriginalConstructor()->onlyMethods(
43 [
'loadLanguageModule',
'txt']
46 $lng->method(
'loadLanguageModule')->with(
48 $this->equalTo(
'chatroom'),
49 $this->equalTo(
'meta')
61 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->onlyMethods(
73 ?InvocationOrder $times =
null
75 if ($times ===
null) {
76 $times = $this->any();
79 return $GLOBALS[
'rbacsystem']->expects($times)
80 ->method(
'checkAccess')
81 ->with($this->equalTo($permission))->willReturn(
88 $ctrl = $this->createMock(ilCtrlInterface::class);
97 $user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->getMock();
106 $this->gui->method(
'getConnector')->willReturn($returnValue);
113 ): InvocationMocker {
114 return $this->ilChatroomMock->method(
'isOwnerOfPrivateRoom')->with(
115 $this->equalTo($userId),
116 $this->equalTo($subRoomId)
117 )->willReturn($result);
122 return $this->ilChatroomUserMock->method(
'getUserId')->willReturn($userId);
130 )->onlyMethods([
'file_get_contents'])->getMock();
132 return $this->ilChatroomServerConnectorMock;
137 return $this->ilChatroomServerConnectorMock->method(
'file_get_contents')->willReturn(
144 $this->
object = $this->getMockBuilder(ilObjChatroom::class)->disableOriginalConstructor()->onlyMethods(
147 $this->
object->method(
'getId')->willReturn($id);
149 return $this->object;
154 $mock->expects($this->once())->method(
'sendResponse')->with(
156 )->willReturnCallback(
157 static function (): never {
158 throw new Exception(
'Exit', 0);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
createGlobalIlLanguageMock()
MockObject &ilObjChatroom $object
MockObject &ilChatroomServerConnector $ilChatroomServerConnectorMock
createIlObjChatroomMock(int $id)
createSendResponseMock(MockObject $mock, $response)
createGlobalRbacSystemMock()
createIlChatroomServerConnectorFileGetContentsMock($returnValue)
createGlobalRbacSystemCheckAccessMock(string $permission, bool $result, ?InvocationOrder $times=null)
createIlChatroomUserGetUserIdMock(int $userId)
createIlObjChatroomGUIGetConnectorMock($returnValue)
createIlChatroomIsOwnerOfPrivateRoomMock(int $userId, int $subRoomId, bool $result)
MockObject &ilChatroomObjectGUI $gui
createIlChatroomServerConnectorMock(ilChatroomServerSettings $settings)
setGlobalVariable(string $name, $value)
Class ilChatroomServerConnector.
Class ilChatroomServerSettings.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...