19 declare(strict_types=1);
32 $default_placeholder_values = $this->getMockBuilder(\ilDefaultPlaceholderValues::class)
33 ->disableOriginalConstructor()
36 $language = $this->getMockBuilder(\ilLanguage::class)
37 ->disableOriginalConstructor()
40 $language->method(
'txt')
41 ->willReturn(
'Some Translation');
43 $object_helper = $this->getMockBuilder(\ilCertificateObjectHelper::class)
46 $test_object = $this->getMockBuilder(\ilObjTest::class)
47 ->disableOriginalConstructor()
50 $test_object->method(
'getActiveIdOfUser')
53 $test_object->method(
'getTestResult')
58 'total_max_points' => 70,
59 'total_reached_points' => 50
64 $test_object->method(
'getTestResult')
67 $test_object->method(
'getTitle')
68 ->willReturn(
' Some Title');
70 $mark_schema = $this->getMockBuilder(\
ILIAS\
Test\Scoring\Marks\MarkSchema::class)
71 ->disableOriginalConstructor()
74 $matching_mark = $this->getMockBuilder(\
ILIAS\
Test\Scoring\Marks\Mark::class)
77 $matching_mark->method(
'getShortName')
80 $matching_mark->method(
'getOfficialName')
83 $mark_schema->method(
'getMatchingMark')
84 ->willReturn($matching_mark);
86 $test_object->method(
'getMarkSchema')
87 ->willReturn($mark_schema);
89 $user_object = $this->getMockBuilder(\ilObjUser::class)
90 ->disableOriginalConstructor()
93 $object_helper->method(
'getInstanceByObjId')
101 $test_object_helper = $this->getMockBuilder(CertificateTestObjectHelper::class)
104 $user_object_helper = $this->getMockBuilder(\ilCertificateUserObjectHelper::class)
107 $user_object_helper->method(
'lookupFields')
108 ->willReturn([
'usr_id' => 10]);
110 $lp_status_helper = $this->getMockBuilder(\ilCertificateLPStatusHelper::class)
113 $lp_status_helper->method(
'lookupStatusChanged')
114 ->willReturn(
'2018-01-12');
116 $util_helper = $this->getMockBuilder(\ilCertificateUtilHelper::class)
117 ->disableOriginalConstructor()
120 $util_helper->method(
'prepareFormOutput')
121 ->willReturn(
'Formatted Output');
123 $date_helper = $this->getMockBuilder(\ilCertificateDateHelper::class)
126 $date_helper->method(
'formatDate')
127 ->willReturn(
'2018-01-12');
129 $date_helper->method(
'formatDateTime')
130 ->willReturn(
'2018-01-12 10:32:01');
133 $default_placeholder_values,
143 $result = $placeholder_values->getPlaceholderValues(10, 200);
146 'RESULT_PASSED' =>
'Formatted Output',
147 'RESULT_POINTS' =>
'Formatted Output',
148 'RESULT_PERCENT' =>
'71.43%',
149 'MAX_POINTS' =>
'Formatted Output',
150 'RESULT_MARK_SHORT' =>
'Formatted Output',
151 'RESULT_MARK_LONG' =>
'Formatted Output',
152 'TEST_TITLE' =>
'Formatted Output',
153 'DATE_COMPLETED' =>
'2018-01-12',
154 'DATETIME_COMPLETED' =>
'2018-01-12 10:32:01' 160 $default_placeholder_values = $this->getMockBuilder(\ilDefaultPlaceholderValues::class)
161 ->disableOriginalConstructor()
164 $default_placeholder_values->method(
'getPlaceholderValuesForPreview')
167 'SOME_PLACEHOLDER' =>
'something',
168 'SOME_OTHER_PLACEHOLDER' =>
'something else',
172 $language = $this->getMockBuilder(\ilLanguage::class)
173 ->disableOriginalConstructor()
176 $language->method(
'txt')
177 ->willReturn(
'Something');
179 $object_mock = $this->getMockBuilder(\ilObject::class)
180 ->disableOriginalConstructor()
183 $object_mock->method(
'getTitle')
184 ->willReturn(
'SomeTitle');
186 $object_helper = $this->getMockBuilder(\ilCertificateObjectHelper::class)
189 $object_helper->method(
'getInstanceByObjId')
190 ->willReturn($object_mock);
192 $test_object_helper = $this->getMockBuilder(CertificateTestObjectHelper::class)
195 $user_object_helper = $this->getMockBuilder(\ilCertificateUserObjectHelper::class)
198 $lp_status_helper = $this->getMockBuilder(\ilCertificateLPStatusHelper::class)
201 $util_helper = $this->getMockBuilder(\ilCertificateUtilHelper::class)
202 ->disableOriginalConstructor()
205 $util_helper->method(
'prepareFormOutput')
206 ->willReturnCallback(
function ($input) {
210 $date_helper = $this->getMockBuilder(\ilCertificateDateHelper::class)
214 $default_placeholder_values,
224 $result = $placeholder_values->getPlaceholderValuesForPreview(100, 10);
228 'SOME_PLACEHOLDER' =>
'something',
229 'SOME_OTHER_PLACEHOLDER' =>
'something else',
230 'RESULT_PASSED' =>
'Something',
231 'RESULT_POINTS' =>
'Something',
232 'RESULT_PERCENT' =>
'Something',
233 'MAX_POINTS' =>
'Something',
234 'RESULT_MARK_SHORT' =>
'Something',
235 'RESULT_MARK_LONG' =>
'Something',
236 'TEST_TITLE' =>
'SomeTitle' Interface Observer Contains several chained tasks and infos about them.
testGetPlaceholderValuesForPreview()