19 declare(strict_types=1);
40 $tpl = $this->getMockBuilder(ilGlobalTemplateInterface::class)->disableOriginalConstructor()->getMock();
41 $lng = $this->getMockBuilder(ilLanguage::class)->disableOriginalConstructor()->getMock();
42 $user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->getMock();
61 $ctrl = $this->getMockBuilder(ilCtrl::class)->disableOriginalConstructor()->getMock();
62 $form = $this->getMockBuilder(ilMailOptionsFormGUI::class)->disableOriginalConstructor()->getMock();
64 $ctrl->method(
'getCmd')->willReturn(
'showOptions');
66 $request = $this->getMockBuilder(ServerRequestInterface::class)->disableOriginalConstructor()->getMock();
67 $request->method(
'getQueryParams')->willReturn([]);
70 $http = $this->getMockBuilder(GlobalHttpState::class)->getMock();
71 $http->method(
'wrapper')->willReturn($wrapper);
73 $settings = $this->getMockBuilder(ilSetting::class)->disableOriginalConstructor()->onlyMethods([
'get'])->getMock();
74 $settings->method(
'get')->willReturnCallback(
static function (
string $key, ?
string $default =
null) {
75 if ($key ===
'show_mail_settings') {
87 $this->createMock(ilDBInterface::class)
92 $gui->executeCommand();
100 $ctrl = $this->getMockBuilder(ilCtrl::class)->disableOriginalConstructor()->getMock();
101 $form = $this->getMockBuilder(ilMailOptionsFormGUI::class)->disableOriginalConstructor()->getMock();
103 $ctrl->method(
'getCmd')->willReturn(
'showOptions');
105 $request = $this->getMockBuilder(ServerRequestInterface::class)->disableOriginalConstructor()->getMock();
106 $request->method(
'getQueryParams')->willReturn([]);
109 $http = $this->getMockBuilder(GlobalHttpState::class)->getMock();
110 $http->method(
'wrapper')->willReturn($wrapper);
112 $ctrl->expects($this->once())->method(
'redirectByClass')->with(ilMailGUI::class);
114 $settings = $this->getMockBuilder(ilSetting::class)->disableOriginalConstructor()->onlyMethods([
'get'])->getMock();
115 $settings->method(
'get')->willReturnCallback(
static function (
string $key, ?
string $default =
null) {
116 if ($key ===
'show_mail_settings') {
128 $this->createMock(ilDBInterface::class)
132 $gui->setForm($form);
133 $gui->executeCommand();
141 $this->expectException(ilCtrlException::class);
143 $request = $this->getMockBuilder(ServerRequestInterface::class)->disableOriginalConstructor()->getMock();
144 $ctrl = $this->createMock(ilCtrlInterface::class);
145 $form = $this->getMockBuilder(ilMailOptionsFormGUI::class)->disableOriginalConstructor()->getMock();
147 $ctrl->method(
'getCmd')->willReturn(
'showOptions');
149 $ctrl->expects($this->once())->method(
'redirectByClass')->with(ilPersonalSettingsGUI::class)->willThrowException(
153 $settings = $this->getMockBuilder(ilSetting::class)->disableOriginalConstructor()->onlyMethods([
'get'])->getMock();
154 $settings->method(
'get')->willReturnCallback(
static function (
string $key, ?
string $default =
null) {
155 if ($key ===
'show_mail_settings') {
162 $request = $this->getMockBuilder(ServerRequestInterface::class)->disableOriginalConstructor()->getMock();
163 $request->method(
'getQueryParams')->willReturn([
164 'referrer' => ilPersonalSettingsGUI::class,
168 $http = $this->getMockBuilder(GlobalHttpState::class)->getMock();
169 $http->method(
'wrapper')->willReturn($wrapper);
176 $this->createMock(ilDBInterface::class)
180 $gui->setForm($form);
181 $gui->executeCommand();
testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWillBeRedirectedToPersonalSettings()
Interface Observer Contains several chained tasks and infos about them.
Class ilMailOptionsGUITest.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getMailOptionsGUI(GlobalHttpState $httpState, ilCtrlInterface $ctrl, ilMailOptions $mail_options)
testMailOptionsAreAccessibleIfGlobalAccessIsNotDenied()
testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWillBeRedirectedToMailSystem()