11 $defaultPlaceholderValues = $this->getMockBuilder(
'ilDefaultPlaceholderValues')
12 ->disableOriginalConstructor()
15 $language = $this->getMockBuilder(
'ilLanguage')
16 ->disableOriginalConstructor()
20 ->willReturn(
'Some Translation');
22 $objectHelper = $this->getMockBuilder(
'ilCertificateObjectHelper')
25 $testObject = $this->getMockBuilder(
'ilObjTest')
26 ->disableOriginalConstructor()
29 $testObject->method(
'getActiveIdOfUser')
32 $testObject->method(
'getTestResult')
37 'total_max_points' => 70,
38 'total_reached_points' => 50
43 $testObject->method(
'getTestResult')
44 ->willReturn(array());
47 $testObject->method(
'getTitle')
48 ->willReturn(
' Some Title');
50 $markSchema = $this->getMockBuilder(
'ASS_MarkSchema')
51 ->disableOriginalConstructor()
54 $matchingMark = $this->getMockBuilder(
'ASS_Mark')
57 $matchingMark->method(
'getShortName')
60 $matchingMark->method(
'getOfficialName')
63 $markSchema->method(
'getMatchingMark')
64 ->willReturn($matchingMark);
66 $testObject->method(
'getMarkSchema')
67 ->willReturn($markSchema);
69 $objectHelper->method(
'getInstanceByObjId')
70 ->willReturn($testObject);
72 $testObjectHelper = $this->getMockBuilder(
'ilCertificateTestObjectHelper')
75 $userObjectHelper = $this->getMockBuilder(
'ilCertificateUserObjectHelper')
78 $userObjectHelper->method(
'lookupFields')
79 ->willReturn(array(
'usr_id' => 10));
81 $lpStatusHelper = $this->getMockBuilder(
'ilCertificateLPStatusHelper')
84 $lpStatusHelper->method(
'lookupStatusChanged')
85 ->willReturn(
'2018-01-12');
87 $utilHelper = $this->getMockBuilder(
'ilCertificateUtilHelper')
90 $utilHelper->method(
'prepareFormOutput')
91 ->willReturn(
'Formatted Output');
93 $dateHelper = $this->getMockBuilder(
'ilCertificateDateHelper')
96 $dateHelper->method(
'formatDate')
97 ->willReturn(
'2018-01-12');
99 $dateHelper->method(
'formatDateTime')
100 ->willReturn(
'2018-01-12 10:32:01');
103 $defaultPlaceholderValues,
113 $result = $placeholdervalues->getPlaceholderValues(10, 200);
115 $this->assertEquals(array(
116 'RESULT_PASSED' =>
'Formatted Output',
117 'RESULT_POINTS' =>
'Formatted Output',
118 'RESULT_PERCENT' =>
'71.43%',
119 'MAX_POINTS' =>
'Formatted Output',
120 'RESULT_MARK_SHORT' =>
'Formatted Output',
121 'RESULT_MARK_LONG' =>
'Formatted Output',
122 'TEST_TITLE' =>
'Formatted Output',
123 'DATE_COMPLETED' =>
'2018-01-12',
124 'DATETIME_COMPLETED' =>
'2018-01-12 10:32:01' 131 $defaultPlaceholderValues = $this->getMockBuilder(
'ilDefaultPlaceholderValues')
132 ->disableOriginalConstructor()
135 $defaultPlaceholderValues->method(
'getPlaceholderValuesForPreview')
138 'SOME_PLACEHOLDER' =>
'something',
139 'SOME_OTHER_PLACEHOLDER' =>
'something else',
143 $language = $this->getMockBuilder(
'ilLanguage')
144 ->disableOriginalConstructor()
148 ->willReturn(
'Something');
150 $objectMock = $this->getMockBuilder(
'ilObject')
151 ->disableOriginalConstructor()
154 $objectMock->method(
'getTitle')
155 ->willReturn(
'SomeTitle');
157 $objectHelper = $this->getMockBuilder(
'ilCertificateObjectHelper')
160 $objectHelper->method(
'getInstanceByObjId')
161 ->willReturn($objectMock);
163 $testObjectHelper = $this->getMockBuilder(
'ilCertificateTestObjectHelper')
166 $userObjectHelper = $this->getMockBuilder(
'ilCertificateUserObjectHelper')
169 $lpStatusHelper = $this->getMockBuilder(
'ilCertificateLPStatusHelper')
172 $utilHelper = $this->getMockBuilder(
'ilCertificateUtilHelper')
175 $utilHelper->method(
'prepareFormOutput')
176 ->willReturnCallback(
function (
$input) {
180 $dateHelper = $this->getMockBuilder(
'ilCertificateDateHelper')
184 $defaultPlaceholderValues,
194 $result = $placeholdervalues->getPlaceholderValuesForPreview(100, 10);
198 'SOME_PLACEHOLDER' =>
'something',
199 'SOME_OTHER_PLACEHOLDER' =>
'something else',
200 'RESULT_PASSED' =>
'Something',
201 'RESULT_POINTS' =>
'Something',
202 'RESULT_PERCENT' =>
'Something',
203 'MAX_POINTS' =>
'Something',
204 'RESULT_MARK_SHORT' =>
'Something',
205 'RESULT_MARK_LONG' =>
'Something',
206 'TEST_TITLE' =>
'SomeTitle'
testGetPlaceholderValuesForPreview()