ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilMailTransportSettingsTest.php
Go to the documentation of this file.
1 <?php
2 
3 require_once 'Services/Mail/test/ilMailBaseTest.php';
4 require_once 'Services/Mail/classes/class.ilMailOptions.php';
5 
7 {
9  {
10  $mailOptions = $this->getMockBuilder('ilMailOptions')
11  ->disableOriginalConstructor()
12  ->setMethods(array('updateOptions'))
13  ->getMock();
14 
15  $mailOptions->setIncomingType(0);
16  $mailOptions->setMailAddressOption(3);
17 
18  $setting = new ilMailTransportSettings($mailOptions);
19  $setting->adjust('test@ilias-test.de', 'someone@php-test.net');
20 
21 
22  $this->assertEquals(0, $mailOptions->getIncomingType());
23  $this->assertEquals(3, $mailOptions->getMailAddressOption());
24  }
25 
27  {
28  $mailOptions = $this->getMockBuilder('ilMailOptions')
29  ->disableOriginalConstructor()
30  ->setMethods(array('updateOptions'))
31  ->getMock();
32 
33  $mailOptions->expects($this->once())->method('updateOptions');
34  $mailOptions->setIncomingType(2);
35  $mailOptions->setMailAddressOption(4);
36 
37  $setting = new ilMailTransportSettings($mailOptions);
38  $setting->adjust('test@ilias-test.de', '');
39 
40 
41  $this->assertEquals(3, $mailOptions->getMailAddressOption());
42  }
43 
45  {
46  $mailOptions = $this->getMockBuilder('ilMailOptions')
47  ->disableOriginalConstructor()
48  ->setMethods(array('updateOptions'))
49  ->getMock();
50 
51  $mailOptions->expects($this->once())->method('updateOptions');
52  $mailOptions->setIncomingType(2);
53  $mailOptions->setMailAddressOption(3);
54 
55  $setting = new ilMailTransportSettings($mailOptions);
56  $setting->adjust('', 'test@ilias-test.de');
57 
58 
59  $this->assertEquals(4, $mailOptions->getMailAddressOption());
60  }
61 
63  {
64  $mailOptions = $this->getMockBuilder('ilMailOptions')
65  ->disableOriginalConstructor()
66  ->setMethods(array('updateOptions'))
67  ->getMock();
68 
69  $mailOptions->expects($this->once())->method('updateOptions');
70  $mailOptions->setIncomingType(2);
71  $mailOptions->setMailAddressOption(3);
72 
73  $setting = new ilMailTransportSettings($mailOptions);
74  $setting->adjust('', '');
75 
76  $this->assertEquals(0, $mailOptions->getIncomingType());
77  }
78 
79  public function testNothingWillBeAdjusted()
80  {
81  $mailOptions = $this->getMockBuilder('ilMailOptions')
82  ->disableOriginalConstructor()
83  ->setMethods(array('updateOptions'))
84  ->getMock();
85 
86  $mailOptions->expects($this->never())->method('updateOptions');
87  $mailOptions->setIncomingType(2);
88  $mailOptions->setMailAddressOption(5);
89 
90  $setting = new ilMailTransportSettings($mailOptions);
91  $setting->adjust('test@ilias-test.de', 'someone@php-test.net');
92 
93  $this->assertEquals(2, $mailOptions->getIncomingType());
94  $this->assertEquals(5, $mailOptions->getMailAddressOption());
95  }
96 }
Create styles array
The data for the language used.