19declare(strict_types=1);
25use PHPUnit\Framework\TestCase;
38 $languageMock = $this->getMockBuilder(ilLanguage::class)
39 ->disableOriginalConstructor()
40 ->onlyMethods([
'txt',
'loadLanguageModule'])
43 $templateMock = $this->getMockBuilder(ilTemplate::class)
44 ->disableOriginalConstructor()
47 $templateMock->method(
'get')
50 $userDefinePlaceholderMock = $this->getMockBuilder(ilUserDefinedFieldsPlaceholderDescription::class)
51 ->disableOriginalConstructor()
54 $userDefinePlaceholderMock->method(
'createPlaceholderHtmlDescription')
57 $userDefinePlaceholderMock->method(
'getPlaceholderDescriptions')
60 $customUserPlaceholderObject = $this->getMockBuilder(ilObjectCustomUserFieldsPlaceholderDescription::class)
61 ->disableOriginalConstructor()
64 $customUserPlaceholderObject->method(
'getPlaceholderDescriptions')
66 '+SOMETHING' =>
'SOMEWHAT',
67 '+SOMETHING_ELSE' =>
'ANYTHING'
70 $customUserPlaceholderObject->method(
'createPlaceholderHtmlDescription')
73 $profile = $this->getMockBuilder(Profile::class)
74 ->disableOriginalConstructor()
77 $placeholderDescriptionObject =
new CoursePlaceholderDescription(200,
null, $languageMock, $userDefinePlaceholderMock, $customUserPlaceholderObject, $profile);
79 $html = $placeholderDescriptionObject->createPlaceholderHtmlDescription($templateMock);
81 $this->assertSame(
'', $html);
86 $languageMock = $this->getMockBuilder(ilLanguage::class)
87 ->disableOriginalConstructor()
88 ->onlyMethods([
'txt'])
91 $languageMock->expects($this->exactly(3))
93 ->willReturn(
'Something translated');
95 $defaultPlaceholder = $this->getMockBuilder(ilDefaultPlaceholderDescription::class)
96 ->disableOriginalConstructor()
99 $defaultPlaceholder->method(
'getPlaceholderDescriptions')
102 'SOMETHING' =>
'SOMEWHAT',
103 'SOMETHING_ELSE' =>
'ANYTHING'
107 $customUserPlaceholderObject = $this->getMockBuilder(ilObjectCustomUserFieldsPlaceholderDescription::class)
108 ->disableOriginalConstructor()
111 $customUserPlaceholderObject->method(
'getPlaceholderDescriptions')
114 '+SOMETHING' =>
'SOMEWHAT',
115 '+SOMETHING_ELSE' =>
'ANYTHING'
119 $profile = $this->getMockBuilder(Profile::class)
120 ->disableOriginalConstructor()
123 $placeholderDescriptionObject =
new CoursePlaceholderDescription(200, $defaultPlaceholder, $languageMock,
null, $customUserPlaceholderObject, $profile);
125 $placeHolders = $placeholderDescriptionObject->getPlaceholderDescriptions();
129 'COURSE_TITLE' =>
'Something translated',
130 'SOMETHING' =>
'SOMEWHAT',
131 'SOMETHING_ELSE' =>
'ANYTHING',
132 '+SOMETHING' =>
'SOMEWHAT',
133 '+SOMETHING_ELSE' =>
'ANYTHING',
134 'DATE_COMPLETED' =>
'Something translated',
135 'DATETIME_COMPLETED' =>
'Something translated'
testPlaceholderGetHtmlDescription()
testPlaceholderDescriptions()
Collection of basic placeholder values that can be used.
special template class to simplify handling of ITX/PEAR