ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilMailOptionsGUITest.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
9 {
16  protected function getMailOptionsGUI(
17  \Psr\Http\Message\ServerRequestInterface $request,
18  \ilCtrl $ctrl,
19  \ilSetting $settings
20  ) {
21  $tpl = $this->getMockBuilder(\ilTemplate::class)->disableOriginalConstructor()->getMock();
22  $lng = $this->getMockBuilder(\ilLanguage::class)->disableOriginalConstructor()->getMock();
23  $user = $this->getMockBuilder(\ilObjUser::class)->disableOriginalConstructor()->getMock();
24  $mail = $this->getMockBuilder(\ilFormatMail::class)->disableOriginalConstructor()->getMock();
25  $mailBox = $this->getMockBuilder(\ilMailbox::class)->disableOriginalConstructor()->getMock();
26 
27  return new \ilMailOptionsGUI(
28  $tpl,
29  $ctrl,
30  $settings,
31  $lng,
32  $user,
33  $request,
34  $mail,
35  $mailBox
36  );
37  }
38 
43  {
44  $request = $this->getMockBuilder(\Psr\Http\Message\ServerRequestInterface::class)->disableOriginalConstructor()->getMock();
45  $ctrl = $this->getMockBuilder(\ilCtrl::class)->disableOriginalConstructor()->getMock();
46  $settings = $this->getMockBuilder(\ilSetting::class)->disableOriginalConstructor()->getMock();
47  $form = $this->getMockBuilder(\ilMailOptionsFormGUI::class)->disableOriginalConstructor()->getMock();
48 
49  $settings->expects($this->any())->method('get')->with('show_mail_settings')->willReturn('1');
50  $ctrl->expects($this->any())->method('getCmd')->willReturn('showOptions');
51  $request->expects($this->any())->method('getQueryParams')->willReturn([]);
52 
53  $gui = $this->getMailOptionsGUI($request, $ctrl, $settings);
54  $gui->setForm($form);
55  $gui->executeCommand();
56  }
57 
59  {
60  $request = $this->getMockBuilder(\Psr\Http\Message\ServerRequestInterface::class)->disableOriginalConstructor()->getMock();
61  $ctrl = $this->getMockBuilder(\ilCtrl::class)->disableOriginalConstructor()->getMock();
62  $settings = $this->getMockBuilder(\ilSetting::class)->disableOriginalConstructor()->getMock();
63  $form = $this->getMockBuilder(\ilMailOptionsFormGUI::class)->disableOriginalConstructor()->getMock();
64 
65  $settings->expects($this->any())->method('get')->with('show_mail_settings')->willReturn('0');
66  $ctrl->expects($this->any())->method('getCmd')->willReturn('showOptions');
67  $request->expects($this->any())->method('getQueryParams')->willReturn([]);
68 
69  $ctrl->expects($this->once())->method('redirectByClass')->with('ilMailGUI');
70 
71  $gui = $this->getMailOptionsGUI($request, $ctrl, $settings);
72  $gui->setForm($form);
73  $gui->executeCommand();
74  }
75 
77  {
78  $request = $this->getMockBuilder(\Psr\Http\Message\ServerRequestInterface::class)->disableOriginalConstructor()->getMock();
79  $ctrl = $this->getMockBuilder(\ilCtrl::class)->disableOriginalConstructor()->getMock();
80  $settings = $this->getMockBuilder(\ilSetting::class)->disableOriginalConstructor()->getMock();
81  $form = $this->getMockBuilder(\ilMailOptionsFormGUI::class)->disableOriginalConstructor()->getMock();
82 
83  $settings->expects($this->any())->method('get')->with('show_mail_settings')->willReturn('0');
84  $ctrl->expects($this->any())->method('getCmd')->willReturn('showOptions');
85 
86  $ctrl->expects($this->once())->method('redirectByClass')->with('ilPersonalSettingsGUI');
87  $request->expects($this->any())->method('getQueryParams')->willReturn([
88  'referrer' => 'ilPersonalSettingsGUI'
89  ]);
90 
91  $gui = $this->getMailOptionsGUI($request, $ctrl, $settings);
92  $gui->setForm($form);
93  $gui->executeCommand();
94  }
95 }
This class provides processing control methods.
testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWillBeRedirectedToPersonalSettings()
foreach($paths as $path) $request
Definition: asyncclient.php:32
$tpl
Definition: ilias.php:10
Class ilMailOptionsGUITest.
Class ilMailBaseTest.
if(isset($_POST['submit'])) $form
$lng
getMailOptionsGUI(\Psr\Http\Message\ServerRequestInterface $request, \ilCtrl $ctrl, \ilSetting $settings)
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
$user
Definition: migrateto20.php:57
testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWillBeRedirectedToMailSystem()