19 declare(strict_types=1);
34 protected function setUp(): void
36 $lng = $this->createMock(\ilLanguage::class);
37 $lng->expects(self::once())->method(
'loadLanguageModule')->with(
'meta');
38 $map = [
'key1' =>
'text',
'key2' =>
'text with %s'];
39 $lng->method(
'txt')->willReturnCallback(
function ($arg) use ($map) {
40 return $map[$arg] ??
'';
42 $lng->method(
'exists')->willReturnCallback(
function ($arg) use ($map) {
43 return key_exists($arg, $map);
46 $this->format = $this->createMock(DateFormat::class);
47 $user = $this->createMock(\ilObjUser::class);
48 $user->method(
'getDateFormat')->willReturn($this->format);
50 $refinery = $this->createMock(Refinery::class);
51 $encoding_group = $this->createMock(EncodeGroup::class);
52 $transformation = $this->createMock(Transformation::class);
53 $transformation->method(
'transform')->willReturnCallback(
function ($arg) {
54 return '~encoded:' . $arg .
'~';
56 $encoding_group->method(
'htmlSpecialCharsAsEntities')->willReturn($transformation);
57 $refinery->method(
'encode')->willReturn($encoding_group);
66 $this->utilities->getUserDateFormat()
74 $this->utilities->txt(
'key1')
82 $this->utilities->txtFill(
'key1',
'more text')
85 'text with more text',
86 $this->utilities->txtFill(
'key2',
'more text')
89 'wrong key first, second',
90 $this->utilities->txtFill(
'wrong key',
'first',
'second')
97 '~encoded:some text~',
98 $this->utilities->sanitizeForHTML(
'some text')