ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilMailOptionsGUITest Class Reference
+ 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

Definition at line 27 of file ilMailOptionsGUITest.php.

Member Function Documentation

◆ getMailOptionsGUI()

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

Definition at line 29 of file ilMailOptionsGUITest.php.

References $lng.

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

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

◆ testMailOptionsAreAccessibleIfGlobalAccessIsNotDenied()

ilMailOptionsGUITest::testMailOptionsAreAccessibleIfGlobalAccessIsNotDenied ( )

Definition at line 50 of file ilMailOptionsGUITest.php.

References $http, getMailOptionsGUI(), and null.

50  : void
51  {
52  $ctrl = $this->getMockBuilder(ilCtrl::class)->disableOriginalConstructor()->getMock();
53  $form = $this->getMockBuilder(ilMailOptionsFormGUI::class)->disableOriginalConstructor()->getMock();
54 
55  $ctrl->method('getCmd')->willReturn('showOptions');
56 
57  $request = $this->getMockBuilder(ServerRequestInterface::class)->disableOriginalConstructor()->getMock();
58  $request->method('getQueryParams')->willReturn([]);
59  $wrapper = new WrapperFactory($request);
60 
61  $http = $this->getMockBuilder(GlobalHttpState::class)->getMock();
62  $http->method('wrapper')->willReturn($wrapper);
63 
64  $settings = $this->getMockBuilder(ilSetting::class)->disableOriginalConstructor()->onlyMethods(['get'])->getMock();
65  $settings->method('get')->willReturnCallback(static function (string $key, ?string $default = null) {
66  if ($key === 'show_mail_settings') {
67  return '1';
68  }
69 
70  return $default;
71  });
72 
73  $options = new ilMailOptions(
74  0,
75  null,
76  $this->createMock(\ILIAS\Data\Clock\ClockInterface::class),
77  $settings,
78  $this->createMock(ilDBInterface::class)
79  );
80 
81  $gui = $this->getMailOptionsGUI($http, $ctrl, $options);
82  $gui->setForm($form);
83  $gui->executeCommand();
84  }
Interface Observer Contains several chained tasks and infos about them.
$http
Definition: deliver.php:30
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getMailOptionsGUI(GlobalHttpState $httpState, ilCtrlInterface $ctrl, ilMailOptions $mail_options)
+ Here is the call graph for this function:

◆ testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWillBeRedirectedToMailSystem()

ilMailOptionsGUITest::testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWillBeRedirectedToMailSystem ( )

Definition at line 86 of file ilMailOptionsGUITest.php.

References $http, getMailOptionsGUI(), and null.

86  : void
87  {
88  $ctrl = $this->getMockBuilder(ilCtrl::class)->disableOriginalConstructor()->getMock();
89  $form = $this->getMockBuilder(ilMailOptionsFormGUI::class)->disableOriginalConstructor()->getMock();
90 
91  $ctrl->method('getCmd')->willReturn('showOptions');
92 
93  $request = $this->getMockBuilder(ServerRequestInterface::class)->disableOriginalConstructor()->getMock();
94  $request->method('getQueryParams')->willReturn([]);
95  $wrapper = new WrapperFactory($request);
96 
97  $http = $this->getMockBuilder(GlobalHttpState::class)->getMock();
98  $http->method('wrapper')->willReturn($wrapper);
99 
100  $ctrl->expects($this->once())->method('redirectByClass')->with(ilMailGUI::class);
101 
102  $settings = $this->getMockBuilder(ilSetting::class)->disableOriginalConstructor()->onlyMethods(['get'])->getMock();
103  $settings->method('get')->willReturnCallback(static function (string $key, ?string $default = null) {
104  if ($key === 'show_mail_settings') {
105  return '0';
106  }
107 
108  return $default;
109  });
110 
111  $options = new ilMailOptions(
112  0,
113  null,
114  $this->createMock(\ILIAS\Data\Clock\ClockInterface::class),
115  $settings,
116  $this->createMock(ilDBInterface::class)
117  );
118 
119  $gui = $this->getMailOptionsGUI($http, $ctrl, $options);
120  $gui->setForm($form);
121  $gui->executeCommand();
122  }
Interface Observer Contains several chained tasks and infos about them.
$http
Definition: deliver.php:30
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getMailOptionsGUI(GlobalHttpState $httpState, ilCtrlInterface $ctrl, ilMailOptions $mail_options)
+ Here is the call graph for this function:

◆ testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWillBeRedirectedToPersonalSettings()

ilMailOptionsGUITest::testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWillBeRedirectedToPersonalSettings ( )

Definition at line 124 of file ilMailOptionsGUITest.php.

References $http, getMailOptionsGUI(), and null.

124  : void
125  {
126  $this->expectException(ilCtrlException::class);
127 
128  $request = $this->getMockBuilder(ServerRequestInterface::class)->disableOriginalConstructor()->getMock();
129  $ctrl = $this->createMock(ilCtrlInterface::class);
130  $form = $this->getMockBuilder(ilMailOptionsFormGUI::class)->disableOriginalConstructor()->getMock();
131 
132  $ctrl->method('getCmd')->willReturn('showOptions');
133 
134  $ctrl->expects($this->once())->method('redirectByClass')->with(ilPersonalSettingsGUI::class)->willThrowException(
135  new ilCtrlException('Script terminated')
136  );
137 
138  $settings = $this->getMockBuilder(ilSetting::class)->disableOriginalConstructor()->onlyMethods(['get'])->getMock();
139  $settings->method('get')->willReturnCallback(static function (string $key, ?string $default = null) {
140  if ($key === 'show_mail_settings') {
141  return '0';
142  }
143 
144  return $default;
145  });
146 
147  $request = $this->getMockBuilder(ServerRequestInterface::class)->disableOriginalConstructor()->getMock();
148  $request->method('getQueryParams')->willReturn([
149  'referrer' => ilPersonalSettingsGUI::class,
150  ]);
151  $wrapper = new WrapperFactory($request);
152 
153  $http = $this->getMockBuilder(GlobalHttpState::class)->getMock();
154  $http->method('wrapper')->willReturn($wrapper);
155 
156  $options = new ilMailOptions(
157  0,
158  null,
159  $this->createMock(\ILIAS\Data\Clock\ClockInterface::class),
160  $settings,
161  $this->createMock(ilDBInterface::class)
162  );
163 
164  $gui = $this->getMailOptionsGUI($http, $ctrl, $options);
165  $gui->setForm($form);
166  $gui->executeCommand();
167  }
Interface Observer Contains several chained tasks and infos about them.
$http
Definition: deliver.php:30
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)
+ Here is the call graph for this function:

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