ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilMailTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22use PHPUnit\Framework\MockObject\MockObject;
28use PHPUnit\Framework\Attributes\DataProvider;
29
31{
32 private MockObject&ilDBInterface $mock_database;
34 private MockObject&ilLogger $mock_log;
36 private MockObject&ilLanguage $mock_language;
37
39 {
40 $refinery = $this->getMockBuilder(Factory::class)->disableOriginalConstructor()->getMock();
41 $this->setGlobalVariable('refinery', $refinery);
42
43 $legal_documents = $this->createMock(Conductor::class);
44 $this->setGlobalVariable('legalDocuments', $legal_documents);
45
46 $this->setGlobalVariable('ilIliasIniFile', $this->createMock(ilIniFile::class));
47 $this->setGlobalVariable('ilDB', $this->createMock(ilDBInterface::class));
48 $this->setGlobalVariable('ilClientIniFile', $this->createMock(ilIniFile::class));
49 $this->setGlobalVariable('lng', $this->createMock(ilLanguage::class));
50 $this->setGlobalVariable('ilCtrl', $this->createMock(ilCtrl::class));
51
52 $web_dir = 'public/data';
53 define('ILIAS_WEB_DIR', $web_dir);
54
55 $sender_usr_id = 666;
56 $active_users_login_to_id_map = [
57 'phpunit1' => 1,
58 'phpunit2' => 2,
59 'phpunit3' => 3,
60 'phpunit4' => 4,
61 'phpunit5' => 5,
62 'phpunit6' => 6,
63 'phpunit7' => 7,
64 ];
65 $expired_users_login_to_id_map = [
66 'phpunit8' => 8,
67 ];
68 $inactive_users_login_to_id_map = [
69 'phpunit9' => 9,
70 ];
71 $inactive_and_expired_users_login_to_id_map = [
72 'phpunit10' => 10,
73 ];
74 $all_users_login_to_id_map = array_merge(
75 $active_users_login_to_id_map,
76 $expired_users_login_to_id_map,
77 $inactive_users_login_to_id_map,
78 $inactive_and_expired_users_login_to_id_map
79 );
80
81 $transformation = $this->createMock(Transformation::class);
82 $transformation->method('applyTo')->willReturn(
83 new Ok(null)
84 );
85 $legal_documents->expects($this->exactly(count($active_users_login_to_id_map)))->method(
86 'userCanReadInternalMail'
87 )->willReturn($transformation);
88
89 $usr_instances_by_id = [];
90 $mail_options_by_id = [];
91
92 $user_groups = [
93 'Active And Not Expired' => [
94 $active_users_login_to_id_map,
95 true,
96 true
97 ],
98 'Active But Expired' => [
99 $expired_users_login_to_id_map,
100 true,
101 false
102 ],
103 'Inactive And Not Expired' => [
104 $inactive_users_login_to_id_map,
105 false,
106 true
107 ],
108 'Inactive And Expired' => [
109 $inactive_and_expired_users_login_to_id_map,
110 false,
111 false
112 ],
113 ];
114
115 foreach ($user_groups as $user_group) {
116 foreach ($user_group[0] as $usr_id) {
117 $user = $this
118 ->getMockBuilder(ilObjUser::class)
119 ->disableOriginalConstructor()
120 ->onlyMethods(['getId', 'checkTimeLimit', 'getActive'])
121 ->getMock();
122 $user->method('getId')->willReturn($usr_id);
123 $user->method('getActive')->willReturn($user_group[1]);
124 $user->method('checkTimeLimit')->willReturn($user_group[2]);
125 $usr_instances_by_id[$usr_id] = $user;
126
127 $mail_options = $this
128 ->getMockBuilder(ilMailOptions::class)
129 ->disableOriginalConstructor()
130 ->onlyMethods(['getExternalEmailAddresses', 'getIncomingType'])
131 ->getMock();
132 $mail_options->method('getExternalEmailAddresses')->willReturn([
133 'phpunit' . $usr_id . '@ilias.de',
134 ]);
135 $mail_options->method('getIncomingType')->willReturn(ilMailOptions::INCOMING_EMAIL);
136 $mail_options_by_id[$usr_id] = $mail_options;
137 }
138 }
139
140 $user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->getMock();
141 ilMailMimeSenderUserById::addUserToCache($sender_usr_id, $user);
142
143 $address_type_factory = $this
144 ->getMockBuilder(ilMailAddressTypeFactory::class)
145 ->disableOriginalConstructor()
146 ->onlyMethods(['getByPrefix'])
147 ->getMock();
148 $address_type_factory
149 ->method('getByPrefix')
150 ->willReturnCallback(function ($arg) use ($all_users_login_to_id_map): object {
151 return new class ($arg, $all_users_login_to_id_map) implements ilMailAddressType {
152 protected array $login_to_id_map = [];
153
154 public function __construct(protected ilMailAddress $address, $login_to_id_map)
155 {
156 $this->login_to_id_map = array_map(static function (int $usr_id): array {
157 return [$usr_id];
158 }, $login_to_id_map);
159 }
160
161 public function resolve(): array
162 {
163 return $this->login_to_id_map[$this->address->getMailbox()] ?? [];
164 }
165
166 public function validate(int $sender_id): bool
167 {
168 return true;
169 }
170
171 public function getErrors(): array
172 {
173 return [];
174 }
175
176 public function getAddress(): ilMailAddress
177 {
178 return $this->address;
179 }
180 };
181 });
182
183 $db = $this->getMockBuilder(ilDBInterface::class)->getMock();
184 $next_id = 0;
185 $db->method('nextId')->willReturnCallback(function () use (&$next_id): int {
186 ++$next_id;
187
188 return $next_id;
189 });
190
191 $event_handler = $this->getMockBuilder(ilAppEventHandler::class)->disableOriginalConstructor()->getMock();
192 $logger = $this->getMockBuilder(ilLogger::class)->disableOriginalConstructor()->getMock();
193 $lng = $this->getMockBuilder(ilLanguage::class)->disableOriginalConstructor()->getMock();
194 $settings = $this->getMockBuilder(ilSetting::class)->disableOriginalConstructor()->getMock();
195 $settings->method('get')->willReturn('');
196 $this->setGlobalVariable('ilSetting', $settings);
197
198 $mail_file_data = $this->getMockBuilder(ilFileDataMail::class)->disableOriginalConstructor()->getMock();
199 $mail_options = $this->getMockBuilder(ilMailOptions::class)->disableOriginalConstructor()->getMock();
200 $mail_box = $this->getMockBuilder(ilMailbox::class)->disableOriginalConstructor()->getMock();
201 $actor = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->getMock();
202 $mustache_factory = $this->getMockBuilder(ilMustacheFactory::class)->getMock();
203
204 $mail_service = new ilMail(
205 $sender_usr_id,
206 $address_type_factory,
208 $event_handler,
209 $logger,
210 $db,
211 $lng,
212 $mail_file_data,
213 $mail_options,
214 $mail_box,
215 new ilMailMimeSenderFactory($settings, $mustache_factory),
216 static fn(string $login): int => $all_users_login_to_id_map[$login] ?? 0,
217 $this->createMock(AutoresponderService::class),
218 0,
219 4711,
220 $actor,
221 new ilMailTemplatePlaceholderResolver(new Mustache_Engine())
222 );
223
224 $old_transport = ilMimeMail::getDefaultTransport();
225
226 $mail_transport = $this
227 ->getMockBuilder(ilMailMimeTransport::class)
228 ->getMock();
229 $mail_transport->expects($this->once())->method('send')->with($this->callback(function (
230 ilMimeMail $mailer
231 ) use ($active_users_login_to_id_map): bool {
232 $total_bcc = [];
233 foreach ($mailer->getBcc() as $bcc) {
234 $total_bcc = array_filter(array_map('trim', explode(',', $bcc))) + $total_bcc;
235 }
236
237 return count($total_bcc) === count($active_users_login_to_id_map);
238 }))->willReturn(true);
239 ilMimeMail::setDefaultTransport($mail_transport);
240
241 $mail_service->setUserInstanceById($usr_instances_by_id);
242 $mail_service->setMailOptionsByUserIdMap($mail_options_by_id);
243
244 $mail_data = new MailDeliveryData(
245 implode(
246 ',',
247 array_merge(
248 array_slice(array_keys($active_users_login_to_id_map), 0, 3),
249 $expired_users_login_to_id_map,
250 $inactive_users_login_to_id_map,
251 $inactive_and_expired_users_login_to_id_map
252 )
253 ),
254 implode(',', array_slice(array_keys($active_users_login_to_id_map), 3, 2)),
255 implode(',', array_slice(array_keys($active_users_login_to_id_map), 5, 2)),
256 'Subject',
257 'Message',
258 [],
259 false
260 );
261 $mail_service->sendMail($mail_data);
262
263 ilMimeMail::setDefaultTransport($old_transport);
264 }
265
266 public function testGetMailObjectReferenceId(): void
267 {
268 $ref_id = 364;
269 $instance = $this->create($ref_id);
270
271 $this->assertSame($ref_id, $instance->getMailObjectReferenceId());
272 }
273
274 public function testFormatNamesForOutput(): void
275 {
276 $instance = $this->create();
277
278 $this->mock_language->expects($this->once())->method('txt')->with('not_available')->willReturn('not_available');
279
280 $this->assertSame('not_available', $instance->formatNamesForOutput(''));
281 $this->assertSame('', $instance->formatNamesForOutput(','));
282 }
283
284 #[DataProvider('provideGetPreviousMail')]
285 public function testGetPreviousMail(array $row_data): void
286 {
287 $mail_id = 3454;
288 $instance = $this->createAndExpectDatabaseCall($mail_id, $row_data);
289 $this->mock_database->expects($this->once())->method('setLimit')->with(1, 0);
290 $instance->getPreviousMail($mail_id);
291 }
292
293 public static function provideGetPreviousMail(): array
294 {
295 return [
296 [[]],
297 [[
298 'attachments' => '',
299 'folder_id' => '',
300 'mail_id' => '',
301 'sender_id' => '',
302 'tpl_ctx_params' => '[]',
303 'use_placeholders' => '',
304 'user_id' => ''
305 ]],
306 [[
307 'folder_id' => '',
308 'mail_id' => '',
309 'sender_id' => '',
310 'use_placeholders' => '',
311 'user_id' => ''
312 ]],
313 ];
314 }
315
316 public function testGetNextMail(): void
317 {
318 $mail_id = 8484;
319 $instance = $this->createAndExpectDatabaseCall($mail_id, []);
320 $this->mock_database->expects($this->once())->method('setLimit')->with(1, 0);
321 $instance->getNextMail($mail_id);
322 }
323
324 public function testGetMailsOfFolder(): void
325 {
326 $filter = ['status' => 'yes'];
327 $row_data = ['mail_id' => 8908];
328 $one = $row_data + [
329 'attachments' => [],
330 'tpl_ctx_params' => [],
331 'm_subject' => '',
332 'm_message' => '',
333 'rcp_to' => '',
334 'rcp_cc' => '',
335 'rcp_bcc' => '',
336 ];
337 $expected = [$one, $one];
338 $folder_id = 89;
339 $usr_id = 901;
340 $instance = $this->create(234, $usr_id);
341 $mock_statement = $this->getMockBuilder(ilDBStatement::class)->getMock();
342 $this->mock_database->expects($this->never())->method('setLimit');
343 $this->mock_database->expects($this->exactly(3))->method('fetchAssoc')->with($mock_statement)->willReturnOnConsecutiveCalls($row_data, $row_data, null);
344 $this->mock_database->expects($this->once())->method('queryF')->willReturnCallback($this->queryCallback($mock_statement, ['integer', 'integer'], [$usr_id, $folder_id]));
345
346 $this->mock_database->expects($this->once())->method('quote')->with($filter['status'], 'text')->willReturn($filter['status']);
347
348 $this->assertEquals($expected, $instance->getMailsOfFolder($folder_id, $filter));
349 }
350
351 public function testCountMailsOfFolder(): void
352 {
353 $usr_id = 46;
354 $folder_id = 68;
355 $num_rows = 89;
356 $instance = $this->create(345, $usr_id);
357 $mock_statement = $this->getMockBuilder(ilDBStatement::class)->getMock();
358 $this->mock_database->expects($this->once())->method('queryF')->willReturnCallback($this->queryCallback($mock_statement, ['integer', 'integer'], [$usr_id, $folder_id]));
359 $this->mock_database->expects($this->once())->method('numRows')->with($mock_statement)->willReturn($num_rows);
360
361 $this->assertSame($num_rows, $instance->countMailsOfFolder($folder_id));
362 }
363
364 public function testGetMail(): void
365 {
366 $mail_id = 7890;
367 $instance = $this->createAndExpectDatabaseCall($mail_id, []);
368 $instance->getMail($mail_id);
369 }
370
371 public function testMarkRead(): void
372 {
373 $mail_ids = [1, 2, 3, 4, 5, 6];
374 $usr_id = 987;
375 $instance = $this->create(567, $usr_id);
376 $this->getMockBuilder(ilDBStatement::class)->getMock();
377 $this->mock_database->expects($this->once())->method('in')->with('mail_id', $mail_ids, false, 'integer')->willReturn('');
378 $this->mock_database->expects($this->once())->method('manipulateF')->willReturnCallback($this->queryCallback(0, ['text', 'integer'], ['read', $usr_id]));
379
380 $instance->markRead($mail_ids);
381 }
382
383 public function testMarkUnread(): void
384 {
385 $mail_ids = [1, 2, 3, 4, 5, 6];
386 $usr_id = 987;
387 $instance = $this->create(567, $usr_id);
388 $this->getMockBuilder(ilDBStatement::class)->getMock();
389 $this->mock_database->expects($this->once())->method('in')->with('mail_id', $mail_ids, false, 'integer')->willReturn('');
390 $this->mock_database->expects($this->once())->method('manipulateF')->willReturnCallback($this->queryCallback(0, ['text', 'integer'], ['unread', $usr_id]));
391
392 $instance->markUnread($mail_ids);
393 }
394
395 public function testMoveMailsToFolder(): void
396 {
397 $mail_ids = [1, 2, 3, 4, 5, 6];
398 $folder_id = 890;
399 $usr_id = 987;
400 $instance = $this->create(567, $usr_id);
401 $this->mock_database->expects($this->once())->method('in')->with('mail_id', $mail_ids, false, 'integer')->willReturn('');
402 $this->mock_database->expects($this->once())->method('manipulateF')->willReturnCallback($this->queryCallback(1, ['integer', 'integer', 'integer'], [$folder_id, $usr_id, $usr_id]));
403
404 $this->assertTrue($instance->moveMailsToFolder($mail_ids, $folder_id));
405 }
406
407 public function testMoveMailsToFolderFalse(): void
408 {
409 $mail_ids = [];
410 $instance = $this->create();
411 $this->mock_database->expects($this->never())->method('in');
412 $this->mock_database->expects($this->never())->method('manipulateF');
413
414 $this->assertFalse($instance->moveMailsToFolder($mail_ids, 892));
415 }
416
417 public function testGetNewDraftId(): void
418 {
419 $next_id = 789;
420 $usr_id = 5678;
421 $folder_id = 47;
422 $instance = $this->create(4749, $usr_id);
423
424 $this->mock_database->expects($this->once())->method('nextId')->with('mail')->willReturn($next_id);
425 $this->mock_database->expects($this->once())->method('insert')->with('mail', [
426 'mail_id' => ['integer', $next_id],
427 'user_id' => ['integer', $usr_id],
428 'folder_id' => ['integer', $folder_id],
429 'sender_id' => ['integer', $usr_id],
430 ]);
431
432 $this->assertSame($next_id, $instance->getNewDraftId($folder_id));
433 }
434
435 public function testUpdateDraft(): void
436 {
437 $folder_id = 7890;
438 $instance = $this->create();
439 $to = 'abc';
440 $cc = 'bcde';
441 $bcc = 'jkl';
442 $subject = 'jlh';
443 $message = 'some message';
444 $use_placeholders = true;
445 $context_id = '87';
446 $params = [];
447 $draft_id = 78;
448
449 $this->mock_database->expects($this->once())->method('update')->with('mail', [
450 'folder_id' => ['integer', $folder_id],
451 'attachments' => ['clob', serialize([])],
452 'send_time' => ['timestamp', date('Y-m-d H:i:s')],
453 'rcp_to' => ['clob', $to],
454 'rcp_cc' => ['clob', $cc],
455 'rcp_bcc' => ['clob', $bcc],
456 'm_status' => ['text', 'read'],
457 'm_subject' => ['text', $subject],
458 'm_message' => ['clob', $message],
459 'use_placeholders' => ['integer', (int) $use_placeholders],
460 'tpl_ctx_id' => ['text', $context_id],
461 'tpl_ctx_params' => ['blob', json_encode($params, JSON_THROW_ON_ERROR)],
462 ], [
463 'mail_id' => ['integer', $draft_id],
464 ]);
465
466 $this->assertSame($draft_id, $instance->updateDraft($folder_id, [], $to, $cc, $bcc, $subject, $message, $draft_id, $use_placeholders, $context_id, $params));
467 }
468
469 public function testPersistingToStage(): void
470 {
471 $usr_id = 897;
472 $attachments = [];
473 $rcp_to = 'jlh';
474 $rcp_cc = 'jhkjh';
475 $rcp_bcc = 'ououi';
476 $subject = 'hbansn';
477 $message = 'message';
478 $use_placeholders = false;
479 $context_id = '9080';
480 $params = [];
481
482 $instance = $this->create(789, $usr_id);
483
484 $this->mock_database->expects($this->once())->method('replace')->with('mail_saved', [
485 'user_id' => ['integer', $usr_id],
486 ], [
487 'attachments' => ['clob', serialize($attachments)],
488 'rcp_to' => ['clob', $rcp_to],
489 'rcp_cc' => ['clob', $rcp_cc],
490 'rcp_bcc' => ['clob', $rcp_bcc],
491 'm_subject' => ['text', $subject],
492 'm_message' => ['clob', $message],
493 'use_placeholders' => ['integer', (int) $use_placeholders],
494 'tpl_ctx_id' => ['text', $context_id],
495 'tpl_ctx_params' => ['blob', json_encode($params, JSON_THROW_ON_ERROR)],
496 ]);
497
498 $mock_statement = $this->getMockBuilder(ilDBStatement::class)->disableOriginalConstructor()->getMock();
499 $this->mock_database->expects($this->once())->method('queryF')->willReturnCallback($this->queryCallback($mock_statement, ['integer'], [$usr_id]));
500 $this->mock_database->expects($this->once())->method('fetchAssoc')->with($mock_statement)->willReturn([
501 'rcp_to' => 'phpunit'
502 ]);
503
504 $instance->persistToStage(
505 78_979_078,
506 $attachments,
507 $rcp_to,
508 $rcp_cc,
509 $rcp_bcc,
510 $subject,
511 $message,
512 $use_placeholders,
513 $context_id,
514 $params,
515 );
516 }
517
518 public function testRetrievalFromStage(): void
519 {
520 $usr_id = 789;
521 $instance = $this->create(67, $usr_id);
522 $mock_statement = $this->getMockBuilder(ilDBStatement::class)->disableOriginalConstructor()->getMock();
523 $this->mock_database->expects($this->once())->method('queryF')->willReturnCallback($this->queryCallback($mock_statement, ['integer'], [$usr_id]));
524 $this->mock_database->expects($this->once())->method('fetchAssoc')->with($mock_statement)->willReturn([
525 'rcp_to' => 'phpunit'
526 ]);
527
528 $mail_data = $instance->retrieveFromStage();
529
530 $this->assertIsArray($mail_data);
531 $this->assertEquals('phpunit', $mail_data['rcp_to']);
532 }
533
534 public function testValidateRecipients($errors = []): void
535 {
536 $to = 'jkhk';
537 $cc = 'hjhjkl';
538 $bcc = 'jklhjk';
539
540 $instance = $this->create();
541 $consecutive_debug = [
542 'Started parsing of recipient string: ' . $to,
543 'Parsed addresses: hello',
544 'Started parsing of recipient string: ' . $cc,
545 'Parsed addresses: hello',
546 'Started parsing of recipient string: ' . $bcc,
547 'Parsed addresses: hello'
548 ];
549 $this->mock_log->expects($this->exactly(6))->method('debug')->with(
550 $this->callback(function ($value) use (&$consecutive_debug) {
551 $this->assertSame(array_shift($consecutive_debug), $value);
552 return true;
553 }),
554 );
555
556 $mock_address = $this->getMockBuilder(ilMailAddress::class)->disableOriginalConstructor()->getMock();
557 $mock_address->expects($this->exactly(3))->method('__toString')->willReturn('hello');
558 $mock_parser = $this->getMockBuilder(ilMailRecipientParser::class)->disableOriginalConstructor()->getMock();
559 $mock_parser->expects($this->exactly(3))->method('parse')->willReturn([$mock_address]);
560 $consecutive_get = [$to, $cc, $bcc];
561 $this->mock_parser_factory->expects($this->exactly(3))->method('getParser')->with(
562 $this->callback(function ($value) use (&$consecutive_get) {
563 $this->assertSame(array_shift($consecutive_get), $value);
564 return true;
565 }),
566 )->willReturn($mock_parser);
567
568 $mock_addressType = $this->getMockBuilder(ilMailAddressType::class)->disableOriginalConstructor()->getMock();
569 $mock_addressType->expects($this->exactly(3))->method('validate')->willReturn(empty($errors));
570 $mock_addressType->expects($this->exactly(empty($errors) ? 0 : 3))->method('getErrors')->willReturn($errors);
571 $this->mock_address_type_factory->expects($this->exactly(3))->method('getByPrefix')->with($mock_address)->willReturn($mock_addressType);
572
573 $this->assertSame([], $instance->validateRecipients($to, $cc, $bcc));
574 }
575
576 public function provideValidateRecipients(): array
577 {
578 return [
579 [[]],
580 [['some error']]
581 ];
582 }
583
584 public function testGetIliasMailerName(): void
585 {
586 $expected = 'Phasellus lacus';
587 $settings = $this->getMockBuilder(ilSetting::class)->disableOriginalConstructor()->getMock();
588 $settings->method('get')->with('mail_system_sys_from_name')->willReturn($expected);
589 $this->setGlobalVariable('ilSetting', $settings);
590
591
592 $this->assertSame($expected, ilMail::_getIliasMailerName());
593 }
594
595 public function testSaveAttachments(): void
596 {
597 $usr_id = 89;
598 $attachments = ['aaa', 'bb', 'cc', 'rrr'];
599 $instance = $this->create(789, $usr_id);
600
601 $this->mock_database->expects($this->once())->method('update')->with(
602 'mail_saved',
603 [
604 'attachments' => ['clob', serialize($attachments)],
605 ],
606 [
607 'user_id' => ['integer', $usr_id],
608 ]
609 );
610
611 $instance->saveAttachments($attachments);
612 }
613
614 private function queryCallback($return_value, array $expected_types, array $expected_values): Closure
615 {
616 return function (string $query, array $types, array $values) use ($expected_types, $expected_values, $return_value) {
617 $this->assertEquals($expected_types, $types);
618 $this->assertEquals($expected_values, $values);
619
620 return $return_value;
621 };
622 }
623
624 private function createAndExpectDatabaseCall(int $some_mail_id, array $row_data): ilMail
625 {
626 $usr_id = 900;
627 $instance = $this->create(234, $usr_id);
628 $mock_statement = $this->getMockBuilder(ilDBStatement::class)->getMock();
629 $this->mock_database->expects($this->once())->method('fetchAssoc')->with($mock_statement)->willReturn($row_data);
630 $this->mock_database->expects($this->once())->method('queryF')->willReturnCallback($this->queryCallback($mock_statement, ['integer', 'integer'], [$usr_id, $some_mail_id]));
631
632 return $instance;
633 }
634
635 private function create(int $ref_id = 234, int $usr_id = 123): ilMail
636 {
637 return new ilMail(
638 $usr_id,
639 ($this->mock_address_type_factory = $this->getMockBuilder(ilMailAddressTypeFactory::class)->disableOriginalConstructor()->getMock()),
640 ($this->mock_parser_factory = $this->getMockBuilder(ilMailRfc822AddressParserFactory::class)->disableOriginalConstructor()->getMock()),
641 $this->getMockBuilder(ilAppEventHandler::class)->disableOriginalConstructor()->getMock(),
642 ($this->mock_log = $this->getMockBuilder(ilLogger::class)->disableOriginalConstructor()->getMock()),
643 ($this->mock_database = $this->getMockBuilder(ilDBInterface::class)->disableOriginalConstructor()->getMock()),
644 ($this->mock_language = $this->getMockBuilder(ilLanguage::class)->disableOriginalConstructor()->getMock()),
645 $this->getMockBuilder(ilFileDataMail::class)->disableOriginalConstructor()->getMock(),
646 $this->getMockBuilder(ilMailOptions::class)->disableOriginalConstructor()->getMock(),
647 $this->getMockBuilder(ilMailbox::class)->disableOriginalConstructor()->getMock(),
648 $this->getMockBuilder(ilMailMimeSenderFactory::class)->disableOriginalConstructor()->getMock(),
649 static fn(string $login): int => 780,
650 $this->createMock(AutoresponderService::class),
651 0,
652 $ref_id,
653 $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->getMock(),
654 $this->getMockBuilder(ilMailTemplatePlaceholderResolver::class)->disableOriginalConstructor()->getMock(),
655 null,
656 null,
657 $this->getMockBuilder(MailSignatureService::class)->disableOriginalConstructor()->getMock(),
658 );
659 }
660}
Builds data types.
Definition: Factory.php:36
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Ok.php:31
return true
language handling
Component logger with individual log levels by component id.
setGlobalVariable(string $name, $value)
static addUserToCache(int $usr_id, ilObjUser $user)
final const int INCOMING_EMAIL
MockObject &ilMailAddressTypeFactory $mock_address_type_factory
Definition: ilMailTest.php:33
testRetrievalFromStage()
Definition: ilMailTest.php:518
testGetMailsOfFolder()
Definition: ilMailTest.php:324
queryCallback($return_value, array $expected_types, array $expected_values)
Definition: ilMailTest.php:614
create(int $ref_id=234, int $usr_id=123)
Definition: ilMailTest.php:635
testValidateRecipients($errors=[])
Definition: ilMailTest.php:534
MockObject &ilMailRfc822AddressParserFactory $mock_parser_factory
Definition: ilMailTest.php:35
testSaveAttachments()
Definition: ilMailTest.php:595
testMoveMailsToFolder()
Definition: ilMailTest.php:395
testExternalMailDeliveryWorksAsExpected()
Definition: ilMailTest.php:38
testGetNewDraftId()
Definition: ilMailTest.php:417
static provideGetPreviousMail()
Definition: ilMailTest.php:293
testGetPreviousMail(array $row_data)
Definition: ilMailTest.php:285
MockObject &ilDBInterface $mock_database
Definition: ilMailTest.php:32
provideValidateRecipients()
Definition: ilMailTest.php:576
testGetMailObjectReferenceId()
Definition: ilMailTest.php:266
MockObject &ilLanguage $mock_language
Definition: ilMailTest.php:36
testFormatNamesForOutput()
Definition: ilMailTest.php:274
testPersistingToStage()
Definition: ilMailTest.php:469
testCountMailsOfFolder()
Definition: ilMailTest.php:351
testGetIliasMailerName()
Definition: ilMailTest.php:584
createAndExpectDatabaseCall(int $some_mail_id, array $row_data)
Definition: ilMailTest.php:624
MockObject &ilLogger $mock_log
Definition: ilMailTest.php:34
testMoveMailsToFolderFalse()
Definition: ilMailTest.php:407
static _getIliasMailerName()
static getDefaultTransport()
static setDefaultTransport(?ilMailMimeTransport $transport)
A transformation is a function from one datatype to another.
Interface ilDBInterface.
$ref_id
Definition: ltiauth.php:66
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $lng
Definition: privfeed.php:31
$message
Definition: xapiexit.php:31