19 declare(strict_types=1);
44 protected function setUp(): void
46 if (!defined(
'ANONYMOUS_USER_ID')) {
47 define(
'ANONYMOUS_USER_ID', 13);
51 $this->dic = is_object($DIC) ? clone
$DIC :
$DIC;
63 $DIC[$name] =
static function (
Container $c) use ($name) {
70 $customUserFieldsPlaceholderValues = $this->getMockBuilder(ilObjectCustomUserFieldsPlaceholderValues::class)
71 ->disableOriginalConstructor()
74 $customUserFieldsPlaceholderValues->method(
'getPlaceholderValues')
77 $defaultPlaceholderValues = $this->getMockBuilder(ilDefaultPlaceholderValues::class)
78 ->disableOriginalConstructor()
81 $defaultPlaceholderValues->method(
'getPlaceholderValues')
84 $language = $this->getMockBuilder(ilLanguage::class)
85 ->disableOriginalConstructor()
88 $language->method(
'txt')
89 ->willReturn(
'Something');
91 $objectMock = $this->getMockBuilder(ilObjCourse::class)
92 ->disableOriginalConstructor()
95 $objectMock->method(
'getTitle')
96 ->willReturn(
'Some Title');
98 $obj_translation = $this->getMockBuilder(ilObjectTranslation::class)
99 ->disableOriginalConstructor()
102 $german = $this->createMock(ilObjectTranslationLanguage::class);
103 $german->method(
'getLanguageCode')
106 $english = $this->createMock(ilObjectTranslationLanguage::class);
107 $english->method(
'getLanguageCode')
110 $obj_translation->method(
'getLanguages')
116 $objectMock->method(
'getObjectTranslation')
117 ->willReturn($obj_translation);
119 $user_object = $this->getMockBuilder(ilObjUser::class)
120 ->disableOriginalConstructor()
123 $objectHelper = $this->getMockBuilder(ilCertificateObjectHelper::class)
125 $objectHelper->method(
'getInstanceByObjId')
133 $participantsHelper = $this->getMockBuilder(CertificateParticipantsHelper::class)
136 $participantsHelper->method(
'getDateTimeOfPassed')
137 ->willReturn(
'2018-09-10');
139 $ilUtilHelper = $this->getMockBuilder(ilCertificateUtilHelper::class)
140 ->disableOriginalConstructor()
143 $ilUtilHelper->method(
'prepareFormOutput')
144 ->willReturn(
'Some Title');
146 $ilDateHelper = $this->getMockBuilder(ilCertificateDateHelper::class)
149 $ilDateHelper->method(
'formatDate')
150 ->willReturn(
'2018-09-10');
152 $ilDateHelper->method(
'formatDateTime')
153 ->willReturn(
'2018-09-10 10:32:00');
155 $database = $this->getMockBuilder(ilDBInterface::class)
162 $customUserFieldsPlaceholderValues,
163 $defaultPlaceholderValues,
170 $placeholderValues = $valuesObject->getPlaceholderValues(100, 200);
174 'COURSE_TITLE' =>
'Some Title',
175 'DATE_COMPLETED' =>
'2018-09-10',
176 'DATETIME_COMPLETED' =>
'2018-09-10 10:32:00' 184 $customUserFieldsPlaceholderValues = $this->getMockBuilder(ilObjectCustomUserFieldsPlaceholderValues::class)
185 ->disableOriginalConstructor()
188 $customUserFieldsPlaceholderValues->method(
'getPlaceholderValuesForPreview')
191 'SOME_PLACEHOLDER' =>
'ANYTHING',
192 'SOME_OTHER_PLACEHOLDER' =>
'2018-09-10',
196 $defaultPlaceholderValues = $this->getMockBuilder(ilDefaultPlaceholderValues::class)
197 ->disableOriginalConstructor()
200 $defaultPlaceholderValues->method(
'getPlaceholderValuesForPreview')
203 'SOME_PLACEHOLDER' =>
'ANYTHING',
204 'SOME_OTHER_PLACEHOLDER' =>
'2018-09-10',
208 $language = $this->getMockBuilder(ilLanguage::class)
209 ->disableOriginalConstructor()
212 $language->method(
'txt')
213 ->willReturn(
'Something');
215 $objectMock = $this->getMockBuilder(ilObjCourse::class)
216 ->disableOriginalConstructor()
219 $objectMock->method(
'getTitle')
220 ->willReturn(
'SomeTitle');
222 $obj_translation = $this->getMockBuilder(ilObjectTranslation::class)
223 ->disableOriginalConstructor()
226 $german = $this->createMock(ilObjectTranslationLanguage::class);
227 $german->method(
'getLanguageCode')
230 $english = $this->createMock(ilObjectTranslationLanguage::class);
231 $english->method(
'getLanguageCode')
234 $obj_translation->method(
'getLanguages')
240 $objectMock->method(
'getObjectTranslation')
241 ->willReturn($obj_translation);
243 $objectHelper = $this->getMockBuilder(ilCertificateObjectHelper::class)
246 $objectHelper->method(
'getInstanceByObjId')
247 ->willReturn($objectMock);
249 $participantsHelper = $this->getMockBuilder(CertificateParticipantsHelper::class)
252 $utilHelper = $this->getMockBuilder(ilCertificateUtilHelper::class)
253 ->disableOriginalConstructor()
256 $utilHelper->method(
'prepareFormOutput')
257 ->willReturnCallback(
function ($input) {
261 $database = $this->getMockBuilder(ilDBInterface::class)
268 $customUserFieldsPlaceholderValues,
269 $defaultPlaceholderValues,
275 $placeholderValues = $valuesObject->getPlaceholderValuesForPreview(100, 10);
279 'SOME_PLACEHOLDER' =>
'ANYTHING',
280 'SOME_OTHER_PLACEHOLDER' =>
'2018-09-10',
281 'COURSE_TITLE' =>
'SomeTitle'
Customizing of pimple-DIC for ILIAS.
testGetPlaceholderValues()
setGlobalVariable(string $name, $value)
testGetPreviewPlaceholderValues()