ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
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 ilMailBaseTest
 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, and $tpl.

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  }
$lng
Class ChatMainBarProvider .
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the caller graph for this function:

◆ testMailOptionsAreAccessibleIfGlobalAccessIsNotDenied()

ilMailOptionsGUITest::testMailOptionsAreAccessibleIfGlobalAccessIsNotDenied ( )

Exceptions
ReflectionException

Definition at line 59 of file ilMailOptionsGUITest.php.

References $http, ILIAS\LTI\ToolProvider\$key, ILIAS\LTI\ToolProvider\$settings, 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  $settings,
86  $this->createMock(ilDBInterface::class)
87  );
88 
89  $gui = $this->getMailOptionsGUI($http, $ctrl, $options);
90  $gui->setForm($form);
91  $gui->executeCommand();
92  }
Class ilMailOptions this class handles user mails.
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
string $key
Consumer key/client ID value.
Definition: System.php:193
$http
Definition: raiseError.php:7
getMailOptionsGUI(GlobalHttpState $httpState, ilCtrlInterface $ctrl, ilMailOptions $mail_options)
+ Here is the call graph for this function:

◆ testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWillBeRedirectedToMailSystem()

ilMailOptionsGUITest::testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWillBeRedirectedToMailSystem ( )
Exceptions
ReflectionException

Definition at line 97 of file ilMailOptionsGUITest.php.

References $http, ILIAS\LTI\ToolProvider\$key, ILIAS\LTI\ToolProvider\$settings, and getMailOptionsGUI().

97  : void
98  {
99  $ctrl = $this->getMockBuilder(ilCtrl::class)->disableOriginalConstructor()->getMock();
100  $form = $this->getMockBuilder(ilMailOptionsFormGUI::class)->disableOriginalConstructor()->getMock();
101 
102  $ctrl->method('getCmd')->willReturn('showOptions');
103 
104  $request = $this->getMockBuilder(ServerRequestInterface::class)->disableOriginalConstructor()->getMock();
105  $request->method('getQueryParams')->willReturn([]);
106  $wrapper = new WrapperFactory($request);
107 
108  $http = $this->getMockBuilder(GlobalHttpState::class)->getMock();
109  $http->method('wrapper')->willReturn($wrapper);
110 
111  $ctrl->expects($this->once())->method('redirectByClass')->with(ilMailGUI::class);
112 
113  $settings = $this->getMockBuilder(ilSetting::class)->disableOriginalConstructor()->onlyMethods(['get'])->getMock();
114  $settings->method('get')->willReturnCallback(static function (string $key, ?string $default = null) {
115  if ($key === 'show_mail_settings') {
116  return '0';
117  }
118 
119  return $default;
120  });
121 
122  $options = new ilMailOptions(
123  0,
124  null,
125  $settings,
126  $this->createMock(ilDBInterface::class)
127  );
128 
129  $gui = $this->getMailOptionsGUI($http, $ctrl, $options);
130  $gui->setForm($form);
131  $gui->executeCommand();
132  }
Class ilMailOptions this class handles user mails.
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
string $key
Consumer key/client ID value.
Definition: System.php:193
$http
Definition: raiseError.php:7
getMailOptionsGUI(GlobalHttpState $httpState, ilCtrlInterface $ctrl, ilMailOptions $mail_options)
+ Here is the call graph for this function:

◆ testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWillBeRedirectedToPersonalSettings()

ilMailOptionsGUITest::testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWillBeRedirectedToPersonalSettings ( )
Exceptions
ReflectionException

Definition at line 137 of file ilMailOptionsGUITest.php.

References $http, ILIAS\LTI\ToolProvider\$key, ILIAS\LTI\ToolProvider\$settings, and getMailOptionsGUI().

137  : void
138  {
139  $this->expectException(ilCtrlException::class);
140 
141  $request = $this->getMockBuilder(ServerRequestInterface::class)->disableOriginalConstructor()->getMock();
142  $ctrl = $this->createMock(ilCtrlInterface::class);
143  $form = $this->getMockBuilder(ilMailOptionsFormGUI::class)->disableOriginalConstructor()->getMock();
144 
145  $ctrl->method('getCmd')->willReturn('showOptions');
146 
147  $ctrl->expects($this->once())->method('redirectByClass')->with(ilPersonalSettingsGUI::class)->willThrowException(
148  new ilCtrlException('Script terminated')
149  );
150 
151  $settings = $this->getMockBuilder(ilSetting::class)->disableOriginalConstructor()->onlyMethods(['get'])->getMock();
152  $settings->method('get')->willReturnCallback(static function (string $key, ?string $default = null) {
153  if ($key === 'show_mail_settings') {
154  return '0';
155  }
156 
157  return $default;
158  });
159 
160  $request = $this->getMockBuilder(ServerRequestInterface::class)->disableOriginalConstructor()->getMock();
161  $request->method('getQueryParams')->willReturn([
162  'referrer' => ilPersonalSettingsGUI::class,
163  ]);
164  $wrapper = new WrapperFactory($request);
165 
166  $http = $this->getMockBuilder(GlobalHttpState::class)->getMock();
167  $http->method('wrapper')->willReturn($wrapper);
168 
169  $options = new ilMailOptions(
170  0,
171  null,
172  $settings,
173  $this->createMock(ilDBInterface::class)
174  );
175 
176  $gui = $this->getMailOptionsGUI($http, $ctrl, $options);
177  $gui->setForm($form);
178  $gui->executeCommand();
179  }
Class ilMailOptions this class handles user mails.
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
string $key
Consumer key/client ID value.
Definition: System.php:193
$http
Definition: raiseError.php:7
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: