34 : void
35 {
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] ?? '';
41 });
42 $lng->method(
'exists')->willReturnCallback(
function ($arg) use ($map) {
43 return key_exists($arg, $map);
44 });
45
46 $this->format = $this->createMock(DateFormat::class);
47 $user = $this->createMock(\ilObjUser::class);
48 $user->method('getDateFormat')->willReturn($this->format);
49
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 . '~';
55 });
56 $encoding_group->method('htmlSpecialCharsAsEntities')->willReturn($transformation);
57 $refinery->method(
'encode')->willReturn($encoding_group);
58
60 }