ILIAS
trunk Revision v12.0_alpha-1227-g7ff6d300864
◀ ilDoc Overview
ilMailBaseTestCase.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
use
ILIAS\DI\Container
;
22
use PHPUnit\Framework\TestCase;
23
use
ILIAS\LegalDocuments\Conductor
;
24
use
ILIAS\Mail\Service\MailService
;
25
26
abstract
class
ilMailBaseTestCase
extends
TestCase
27
{
28
private
?
Container
$dic
=
null
;
29
30
protected
function
brutallyTrimHTML
(
string
$html): string
31
{
32
$html = str_replace([
"\n"
,
"\r"
,
"\t"
],
''
, $html);
33
$html = preg_replace(
'# {2,}#'
,
' '
, $html);
34
$html = preg_replace(
'/<!--(.|\s)*?-->/'
,
''
, $html);
35
$html = preg_replace(
"/>(\s+)</"
,
'><'
, $html);
36
$html = str_replace([
' >'
,
' <'
], [
'>'
,
'<'
], $html);
37
38
return
trim($html);
39
}
40
41
protected
function
setUp
(): void
42
{
43
if
(!defined(
'ANONYMOUS_USER_ID'
)) {
44
define(
'ANONYMOUS_USER_ID'
, 13);
45
}
46
47
global
$DIC
;
48
49
$this->dic = is_object(
$DIC
) ? clone
$DIC
:
$DIC
;
50
51
$DIC
=
new
Container
();
52
$DIC
[
'legalDocuments'
] = fn() => $this->getMockBuilder(Conductor::class)->disableOriginalConstructor()->getMock();
53
54
MailService::init
(
$DIC
);
55
56
parent::setUp();
57
}
58
59
protected
function
tearDown
(): void
60
{
61
global
$DIC
;
62
63
$DIC
=
$this->dic
;
64
65
parent::tearDown();
66
}
67
68
protected
function
setGlobalVariable
(
string
$name, $value): void
69
{
70
global
$DIC
;
71
72
$GLOBALS
[$name] = $value;
73
74
75
unset(
$DIC
[$name]);
76
$DIC
[$name] =
static
fn(
Container
$c
) =>
$GLOBALS
[$name];
77
}
78
}
ILIAS\DI\Container
Customizing of pimple-DIC for ILIAS.
Definition:
Container.php:36
ILIAS\LegalDocuments\Conductor
Definition:
Conductor.php:47
ILIAS\Mail\Service\MailService
Definition:
MailService.php:39
ilMailBaseTestCase
Definition:
ilMailBaseTestCase.php:27
ilMailBaseTestCase\brutallyTrimHTML
brutallyTrimHTML(string $html)
Definition:
ilMailBaseTestCase.php:30
ilMailBaseTestCase\$dic
Container $dic
Definition:
ilMailBaseTestCase.php:28
ilMailBaseTestCase\setUp
setUp()
Definition:
ilMailBaseTestCase.php:41
ilMailBaseTestCase\setGlobalVariable
setGlobalVariable(string $name, $value)
Definition:
ilMailBaseTestCase.php:68
ilMailBaseTestCase\tearDown
tearDown()
Definition:
ilMailBaseTestCase.php:59
$c
$c
Definition:
deliver.php:25
init
init()
Definition:
ilPRGCertificateHelper.php:29
$DIC
global $DIC
Definition:
shib_login.php:26
$GLOBALS
$GLOBALS["DIC"]
Definition:
wac.php:54
components
ILIAS
Mail
tests
ilMailBaseTestCase.php
Generated on Wed Apr 8 2026 23:05:12 for ILIAS by
1.9.4 (using
Doxyfile
)