ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilMailOptionsGUITest Class Reference

Class ilMailOptionsGUITest. More...

+ Inheritance diagram for ilMailOptionsGUITest:
+ Collaboration diagram for ilMailOptionsGUITest:

Public Member Functions

 testMailOptionsAreAccessibleIfGlobalAccessIsNotDenied ()
 
 testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWillBeRedirectedToMailSystem ()
 
 testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWillBeRedirectedToPersonalSettings ()
 

Protected Member Functions

 getMailOptionsGUI (GlobalHttpState $httpState, ilCtrlInterface $ctrl, ilMailOptions $mail_options)
 
- Protected Member Functions inherited from ilMailBaseTestCase
 brutallyTrimHTML (string $html)
 
 setUp ()
 
 tearDown ()
 
 setGlobalVariable (string $name, $value)
 

Detailed Description

Class ilMailOptionsGUITest.

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de

Definition at line 30 of file ilMailOptionsGUITest.php.

Member Function Documentation

◆ getMailOptionsGUI()

ilMailOptionsGUITest::getMailOptionsGUI ( GlobalHttpState  $httpState,
ilCtrlInterface  $ctrl,
ilMailOptions  $mail_options 
)
protected
Exceptions
ReflectionException

Definition at line 35 of file ilMailOptionsGUITest.php.

References $lng.

Referenced by testMailOptionsAreAccessibleIfGlobalAccessIsNotDenied(), testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWillBeRedirectedToMailSystem(), and testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWillBeRedirectedToPersonalSettings().

40  $tpl = $this->getMockBuilder(ilGlobalTemplateInterface::class)->disableOriginalConstructor()->getMock();
41  $lng = $this->getMockBuilder(ilLanguage::class)->disableOriginalConstructor()->getMock();
42  $user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->getMock();
43 
44  return new ilMailOptionsGUI(
45  $tpl,
46  $ctrl,
47  $lng,
48  $user,
49  $httpState,
50  new Factory(new \ILIAS\Data\Factory(), $lng),
51  $mail_options
52  );
53  }
Interface Observer Contains several chained tasks and infos about them.
global $lng
Definition: privfeed.php:32
+ Here is the caller graph for this function:

◆ testMailOptionsAreAccessibleIfGlobalAccessIsNotDenied()

ilMailOptionsGUITest::testMailOptionsAreAccessibleIfGlobalAccessIsNotDenied ( )

Exceptions
ReflectionException

Definition at line 59 of file ilMailOptionsGUITest.php.

References $http, and getMailOptionsGUI().

59  : void
60  {
61  $ctrl = $this->getMockBuilder(ilCtrl::class)->disableOriginalConstructor()->getMock();
62  $form = $this->getMockBuilder(ilMailOptionsFormGUI::class)->disableOriginalConstructor()->getMock();
63 
64  $ctrl->method('getCmd')->willReturn('showOptions');
65 
66  $request = $this->getMockBuilder(ServerRequestInterface::class)->disableOriginalConstructor()->getMock();
67  $request->method('getQueryParams')->willReturn([]);
68  $wrapper = new WrapperFactory($request);
69 
70  $http = $this->getMockBuilder(GlobalHttpState::class)->getMock();
71  $http->method('wrapper')->willReturn($wrapper);
72 
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') {
76  return '1';
77  }
78 
79  return $default;
80  });
81 
82  $options = new ilMailOptions(
83  0,
84  null,
85  $this->createMock(\ILIAS\Data\Clock\ClockInterface::class),
86  $settings,
87  $this->createMock(ilDBInterface::class)
88  );
89 
90  $gui = $this->getMailOptionsGUI($http, $ctrl, $options);
91  $gui->setForm($form);
92  $gui->executeCommand();
93  }
Interface Observer Contains several chained tasks and infos about them.
$http
Definition: deliver.php:14
getMailOptionsGUI(GlobalHttpState $httpState, ilCtrlInterface $ctrl, ilMailOptions $mail_options)
+ Here is the call graph for this function:

◆ testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWillBeRedirectedToMailSystem()

ilMailOptionsGUITest::testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWillBeRedirectedToMailSystem ( )
Exceptions
ReflectionException

Definition at line 98 of file ilMailOptionsGUITest.php.

References $http, and getMailOptionsGUI().

98  : void
99  {
100  $ctrl = $this->getMockBuilder(ilCtrl::class)->disableOriginalConstructor()->getMock();
101  $form = $this->getMockBuilder(ilMailOptionsFormGUI::class)->disableOriginalConstructor()->getMock();
102 
103  $ctrl->method('getCmd')->willReturn('showOptions');
104 
105  $request = $this->getMockBuilder(ServerRequestInterface::class)->disableOriginalConstructor()->getMock();
106  $request->method('getQueryParams')->willReturn([]);
107  $wrapper = new WrapperFactory($request);
108 
109  $http = $this->getMockBuilder(GlobalHttpState::class)->getMock();
110  $http->method('wrapper')->willReturn($wrapper);
111 
112  $ctrl->expects($this->once())->method('redirectByClass')->with(ilMailGUI::class);
113 
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') {
117  return '0';
118  }
119 
120  return $default;
121  });
122 
123  $options = new ilMailOptions(
124  0,
125  null,
126  $this->createMock(\ILIAS\Data\Clock\ClockInterface::class),
127  $settings,
128  $this->createMock(ilDBInterface::class)
129  );
130 
131  $gui = $this->getMailOptionsGUI($http, $ctrl, $options);
132  $gui->setForm($form);
133  $gui->executeCommand();
134  }
Interface Observer Contains several chained tasks and infos about them.
$http
Definition: deliver.php:14
getMailOptionsGUI(GlobalHttpState $httpState, ilCtrlInterface $ctrl, ilMailOptions $mail_options)
+ Here is the call graph for this function:

◆ testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWillBeRedirectedToPersonalSettings()

ilMailOptionsGUITest::testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWillBeRedirectedToPersonalSettings ( )
Exceptions
ReflectionException

Definition at line 139 of file ilMailOptionsGUITest.php.

References $http, and getMailOptionsGUI().

139  : void
140  {
141  $this->expectException(ilCtrlException::class);
142 
143  $request = $this->getMockBuilder(ServerRequestInterface::class)->disableOriginalConstructor()->getMock();
144  $ctrl = $this->createMock(ilCtrlInterface::class);
145  $form = $this->getMockBuilder(ilMailOptionsFormGUI::class)->disableOriginalConstructor()->getMock();
146 
147  $ctrl->method('getCmd')->willReturn('showOptions');
148 
149  $ctrl->expects($this->once())->method('redirectByClass')->with(ilPersonalSettingsGUI::class)->willThrowException(
150  new ilCtrlException('Script terminated')
151  );
152 
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') {
156  return '0';
157  }
158 
159  return $default;
160  });
161 
162  $request = $this->getMockBuilder(ServerRequestInterface::class)->disableOriginalConstructor()->getMock();
163  $request->method('getQueryParams')->willReturn([
164  'referrer' => ilPersonalSettingsGUI::class,
165  ]);
166  $wrapper = new WrapperFactory($request);
167 
168  $http = $this->getMockBuilder(GlobalHttpState::class)->getMock();
169  $http->method('wrapper')->willReturn($wrapper);
170 
171  $options = new ilMailOptions(
172  0,
173  null,
174  $this->createMock(\ILIAS\Data\Clock\ClockInterface::class),
175  $settings,
176  $this->createMock(ilDBInterface::class)
177  );
178 
179  $gui = $this->getMailOptionsGUI($http, $ctrl, $options);
180  $gui->setForm($form);
181  $gui->executeCommand();
182  }
Interface Observer Contains several chained tasks and infos about them.
$http
Definition: deliver.php:14
ilCtrl exceptions
getMailOptionsGUI(GlobalHttpState $httpState, ilCtrlInterface $ctrl, ilMailOptions $mail_options)
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: