19 declare(strict_types=1);
28 $objectMock = $this->getMockBuilder(ilObjUser::class)
29 ->disableOriginalConstructor()
50 $objectMock->expects($this->once())
52 ->willReturn(
'a_login');
54 $objectMock->expects($this->once())
55 ->method(
'getFullname')
56 ->willReturn(
'Niels Theen');
58 $objectMock->expects($this->once())
59 ->method(
'getFirstname')
60 ->willReturn(
'Niels');
62 $objectMock->expects($this->once())
63 ->method(
'getLastname')
64 ->willReturn(
'Theen');
66 $objectMock->expects($this->once())
70 $objectMock->expects($this->once())
74 $objectMock->expects($this->once())
75 ->method(
'getBirthday')
76 ->willReturn(
'2018-10-10');
78 $objectMock->expects($this->once())
79 ->method(
'getInstitution')
82 $objectMock->expects($this->once())
83 ->method(
'getDepartment')
86 $objectMock->expects($this->once())
90 $objectMock->expects($this->once())
94 $objectMock->expects($this->once())
95 ->method(
'getZipcode')
98 $objectMock->expects($this->once())
99 ->method(
'getCountry')
102 $objectMock->expects($this->once())
103 ->method(
'getMatriculation')
106 $objectHelper = $this->getMockBuilder(ilCertificateObjectHelper::class)
109 $objectHelper->expects($this->once())
110 ->method(
'getInstanceByObjId')
112 ->willReturn($objectMock);
114 $dateHelper = $this->getMockBuilder(ilCertificateDateHelper::class)
117 $dateHelper->expects($this->exactly(2))
118 ->method(
'formatDate')
119 ->willReturn(
'2018-09-10');
121 $dateHelper->expects($this->once())
122 ->method(
'formatDateTime')
123 ->willReturn(
'2018-09-10 12:01:33');
125 $language = $this->getMockBuilder(ilLanguage::class)
126 ->disableOriginalConstructor()
129 $language->method(
'txt')
130 ->willReturn(
'Something');
132 $utilHelper = $this->getMockBuilder(ilCertificateUtilHelper::class)
135 $utilHelper->method(
'prepareFormOutput')
136 ->willReturnCallback(
function ($input) {
140 $userDefinePlaceholderMock = $this->getMockBuilder(ilUserDefinedFieldsPlaceholderValues::class)
141 ->disableOriginalConstructor()
144 $userDefinePlaceholderMock->method(
'getPlaceholderValues')
147 $userDefinePlaceholderMock->method(
'getPlaceholderValuesForPreview')
156 $userDefinePlaceholderMock,
160 $result = $placeHolderObject->getPlaceholderValues(100, 200);
164 'USER_LOGIN' =>
'a_login',
165 'USER_FULLNAME' =>
'Niels Theen',
166 'USER_FIRSTNAME' =>
'Niels',
167 'USER_LASTNAME' =>
'Theen',
169 'USER_SALUTATION' =>
'Something',
170 'USER_BIRTHDAY' =>
'2018-09-10',
171 'USER_INSTITUTION' =>
'',
172 'USER_DEPARTMENT' =>
'',
175 'USER_ZIPCODE' =>
'',
176 'USER_COUNTRY' =>
'',
177 'USER_MATRICULATION' =>
'',
178 'DATE_COMPLETED' =>
'',
179 'DATETIME_COMPLETED' =>
'',
180 'DATE' =>
'2018-09-10',
181 'DATETIME' =>
'2018-09-10 12:01:33' 189 $objectHelper = $this->getMockBuilder(ilCertificateObjectHelper::class)
192 $dateHelper = $this->getMockBuilder(ilCertificateDateHelper::class)
195 $dateHelper->method(
'formatDate')
196 ->willReturn(
'2018-09-09');
198 $dateHelper->method(
'formatDateTime')
199 ->willReturn(
'2018-09-09 14:00:30');
201 $language = $this->getMockBuilder(ilLanguage::class)
202 ->disableOriginalConstructor()
205 $language->method(
'txt')
206 ->willReturn(
'Something');
208 $utilHelper = $this->getMockBuilder(ilCertificateUtilHelper::class)
211 $utilHelper->method(
'prepareFormOutput')
212 ->willReturnCallback(
function ($input) {
216 $userDefinePlaceholderMock = $this->getMockBuilder(ilUserDefinedFieldsPlaceholderValues::class)
217 ->disableOriginalConstructor()
220 $userDefinePlaceholderMock->method(
'getPlaceholderValues')
223 $userDefinePlaceholderMock->method(
'getPlaceholderValuesForPreview')
232 $userDefinePlaceholderMock,
236 $result = $placeHolderObject->getPlaceholderValuesForPreview(
243 'USER_LOGIN' =>
'Something',
244 'USER_FULLNAME' =>
'Something',
245 'USER_FIRSTNAME' =>
'Something',
246 'USER_LASTNAME' =>
'Something',
247 'USER_TITLE' =>
'Something',
248 'USER_SALUTATION' =>
'Something',
249 'USER_BIRTHDAY' =>
'2018-09-09',
250 'USER_INSTITUTION' =>
'Something',
251 'USER_DEPARTMENT' =>
'Something',
252 'USER_STREET' =>
'Something',
253 'USER_CITY' =>
'Something',
254 'USER_ZIPCODE' =>
'Something',
255 'USER_COUNTRY' =>
'Something',
256 'USER_MATRICULATION' =>
'Something',
257 'DATE' =>
'2018-09-09',
258 'DATETIME' =>
'2018-09-09 14:00:30',
259 'DATE_COMPLETED' =>
'2018-09-09',
260 'DATETIME_COMPLETED' =>
'2018-09-09 14:00:30' Collection of basic placeholder values that can be used.
testGetPlaceholderValues()
Class ilCertificateBaseTestCase.
testGetPlaceholderValuesForPreview()