◆ provideMailOptionsData()
| static ilMailOptionsTest::provideMailOptionsData |
( |
| ) |
|
|
static |
Definition at line 167 of file ilMailOptionsTest.php.
169 yield
'correct configuration' => [
170 'absence_status' =>
true,
171 'absent_from' => 100,
172 'absent_until' => 100,
176 yield
'not absent' => [
177 'absence_status' =>
false,
178 'absent_from' => 100,
179 'absent_until' => 100,
183 yield
'absent, absent_from is in the future' => [
184 'absence_status' =>
true,
185 'absent_from' => 100 + 1,
186 'absent_until' => 100,
190 yield
'absent, absent_until is in the past' => [
191 'absence_status' =>
true,
192 'absent_from' => 100,
193 'absent_until' => 100 - 1,
197 yield
'absent, absent_from is in the past, absent_until is in the future' => [
198 'absence_status' =>
true,
199 'absent_from' => 100 - 1,
200 'absent_until' => 100 + 1,
◆ setUp()
| ilMailOptionsTest::setUp |
( |
| ) |
|
|
protected |
Definition at line 33 of file ilMailOptionsTest.php.
References ilMailBaseTestCase\setGlobalVariable().
37 $this->database = $this->getMockBuilder(ilDBInterface::class)
39 $queryMock = $this->getMockBuilder(ilDBStatement::class)
43 $this->
object->cronjob_notification =
false;
44 $this->
object->signature =
'smth';
45 $this->
object->incoming_type = 1;
46 $this->
object->mail_address_option = 0;
47 $this->
object->email =
'test@test.com';
48 $this->
object->second_email =
'ilias@ilias.com';
49 $this->
object->absence_status =
false;
50 $this->
object->absent_from = time();
51 $this->
object->absent_until = time();
52 $this->
object->absence_ar_subject =
'subject';
53 $this->
object->absence_ar_body =
'body';
56 $this->database->expects($this->once())->method(
'queryF')->willReturn($queryMock);
57 $this->database->expects($this->once())->method(
'fetchObject')->willReturn($this->
object);
58 $this->database->method(
'replace')->willReturn(0);
setGlobalVariable(string $name, $value)
◆ testConstructor()
| ilMailOptionsTest::testConstructor |
( |
| ) |
|
Definition at line 62 of file ilMailOptionsTest.php.
References ilMailOptions\INCOMING_LOCAL.
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 ===
'mail_incoming_mail' || $key ===
'mail_address_option') {
70 if ($key ===
'show_mail_settings') {
80 $this->createMock(ClockInterface::class),
84 $this->assertSame(
'', $mailOptions->getSignature());
86 $this->assertFalse($mailOptions->isCronJobNotificationEnabled());
MockObject &ilSetting $settings
final const INCOMING_LOCAL
◆ testConstructorWithUserSettings()
| ilMailOptionsTest::testConstructorWithUserSettings |
( |
| ) |
|
Definition at line 89 of file ilMailOptionsTest.php.
References ILIAS\Repository\object().
91 $settings = $this->getMockBuilder(ilSetting::class)->disableOriginalConstructor()->onlyMethods([
'get'])->getMock();
92 $settings->method(
'get')->willReturnCallback(
static function (
string $key, ?
string $default = null) {
93 if ($key ===
'mail_incoming_mail' || $key ===
'mail_address_option') {
97 if ($key ===
'show_mail_settings') {
101 if ($key ===
'usr_settings_disable_mail_incoming_mail') {
111 $this->createMock(ClockInterface::class),
115 $this->assertSame($this->
object->signature, $mailOptions->getSignature());
116 $this->assertSame($this->
object->incoming_type, $mailOptions->getIncomingType());
117 $this->assertSame($this->
object->cronjob_notification, $mailOptions->isCronJobNotificationEnabled());
118 $this->assertSame($this->
object->absence_status, $mailOptions->getAbsenceStatus());
119 $this->assertSame($this->
object->absent_from, $mailOptions->getAbsentFrom());
120 $this->assertSame($this->
object->absent_until, $mailOptions->getAbsentUntil());
121 $this->assertSame($this->
object->absence_ar_subject, $mailOptions->getAbsenceAutoresponderSubject());
122 $this->assertSame($this->
object->absence_ar_body, $mailOptions->getAbsenceAutoresponderBody());
MockObject &ilSetting $settings
◆ testIsAbsent()
| ilMailOptionsTest::testIsAbsent |
( |
bool |
$absence_status, |
|
|
int |
$absent_from, |
|
|
int |
$absent_until, |
|
|
bool |
$result |
|
) |
| |
provideMailOptionsData
Definition at line 128 of file ilMailOptionsTest.php.
131 $this->
object->absence_status = $absence_status;
132 $this->
object->absent_from = $absent_from;
133 $this->
object->absent_until = $absent_until;
134 $this->
object->absence_ar_subject =
'subject';
135 $this->
object->absence_ar_body =
'body';
137 $clockService = $this->createMock(ClockInterface::class);
138 $clockService->method(
'now')->willReturn((
new DateTimeImmutable())->setTimestamp(100));
140 $settings = $this->getMockBuilder(ilSetting::class)->disableOriginalConstructor()->onlyMethods([
'get'])->getMock();
141 $settings->method(
'get')->willReturnCallback(
static function (
string $key, ?
string $default = null) {
142 if ($key ===
'mail_incoming_mail' || $key ===
'mail_address_option') {
146 if ($key ===
'show_mail_settings') {
150 if ($key ===
'usr_settings_disable_mail_incoming_mail') {
164 $this->assertEquals($result, $mailOptions->isAbsent());
MockObject &ilSetting $settings
◆ $database
◆ $object
| stdClass ilMailOptionsTest::$object |
|
protected |
◆ $settings
| MockObject& ilSetting ilMailOptionsTest::$settings |
|
protected |
The documentation for this class was generated from the following file: