3require_once dirname(__FILE__) .
'/class.ilChatroomAbstractTaskTest.php';
28 require_once
'./Modules/Chatroom/test/mocks/class.ilChatroomTaskHandlerMock.php';
29 $this->handler =
new ilChatroomGUIHandlerMock($this->gui);
34 $this->assertEquals(
'default', $this->handler->executeDefault(
'default'));
39 $this->assertTrue($this->handler->execute(
'testFunc'));
44 $this->assertEquals(
'nonExistingFunc', $this->handler->execute(
'nonExistingFunc'));
50 $this->assertTrue($this->handler->isSuccessful(json_encode(
$response)));
53 $this->assertFalse($this->handler->isSuccessful(json_encode(
$response)));
56 $this->assertFalse($this->handler->isSuccessful(json_encode(
$response)));
59 $this->assertFalse($this->handler->isSuccessful(
$response));
77 $this->assertEquals(
$result, $this->handler->mockedCanModerate($this->ilChatroomMock, $subRoomId, $userId));
83 $this->handler->mockedExitIfNoRoomExists($this->ilChatroomMock);
85 $this->setExpectedException(
90 'reason' =>
'unkown room',
94 $this->handler->mockedExitIfNoRoomExists(
null);
108 $this->handler->mockedExitIfNoRoomPermission($this->ilChatroomMock, $subRoomId, $this->ilChatroomUserMock);
122 $this->setExpectedException(
127 'reason' =>
'not owner of private room',
132 $this->handler->mockedExitIfNoRoomPermission($this->ilChatroomMock, $subRoomId, $this->ilChatroomUserMock);
143 $this->handler->redirectIfNoPermission(
'moderate');
144 $this->handler->redirectIfNoPermission(
'user');
153 array(
true,
true,
true),
154 array(
true,
false,
false),
155 array(
false,
true,
false),
An exception for terminatinating execution or to throw for unit testing.
Class ilChatroomAbstractTaskTest.
createIlChatroomIsOwnerOfPrivateRoomMock($userId, $subRoomId, $result)
createIlChatroomUserGetUserIdMock($userId)
createIlObjChatroomGUIMock($object)
createIlObjChatroomMock($id)
createGlobalRbacSystemMock()
createGlobalRbacSystemCheckAccessMock($permission, $result, $times=null)
createGlobalIlLanguageMock()
createIlChatroomUserMock()
Class ilChatroomTaskHandlerTest.
testRedirectIfNoPermission()
testExitIfNoRoomPermissionSuccess()
testExecuteWithMethodExit()
canModerateDataProvider()
testExecuteWithMethodNotExit()
testCanModerate($isOwnerOfPrivateRoomValue, $checkAccessValue, $result)
@dataProvider canModerateDataProvider
testExitIfNoRoomPermissionFails()