19declare(strict_types=1);
27 $objectMock = $this->getMockBuilder(ilObjUser::class)
28 ->disableOriginalConstructor()
49 $objectMock->expects($this->once())
51 ->willReturn(
'a_login');
53 $objectMock->expects($this->once())
54 ->method(
'getFullname')
55 ->willReturn(
'Niels Theen');
57 $objectMock->expects($this->once())
58 ->method(
'getFirstname')
59 ->willReturn(
'Niels');
61 $objectMock->expects($this->once())
62 ->method(
'getLastname')
63 ->willReturn(
'Theen');
65 $objectMock->expects($this->once())
69 $objectMock->expects($this->once())
73 $objectMock->expects($this->once())
74 ->method(
'getBirthday')
75 ->willReturn(
'2018-10-10');
77 $objectMock->expects($this->once())
78 ->method(
'getInstitution')
81 $objectMock->expects($this->once())
82 ->method(
'getDepartment')
85 $objectMock->expects($this->once())
89 $objectMock->expects($this->once())
93 $objectMock->expects($this->once())
94 ->method(
'getZipcode')
97 $objectMock->expects($this->once())
98 ->method(
'getCountry')
101 $objectMock->expects($this->once())
102 ->method(
'getMatriculation')
105 $objectHelper = $this->getMockBuilder(ilCertificateObjectHelper::class)
108 $objectHelper->expects($this->once())
109 ->method(
'getInstanceByObjId')
111 ->willReturn($objectMock);
113 $dateHelper = $this->getMockBuilder(ilCertificateDateHelper::class)
116 $dateHelper->expects($this->exactly(2))
117 ->method(
'formatDate')
118 ->willReturn(
'2018-09-10');
120 $dateHelper->expects($this->once())
121 ->method(
'formatDateTime')
122 ->willReturn(
'2018-09-10 12:01:33');
124 $language = $this->getMockBuilder(ilLanguage::class)
125 ->disableOriginalConstructor()
128 $language->method(
'txt')
129 ->willReturn(
'Something');
131 $profile = $this->getMockBuilder(Profile::class)
132 ->disableOriginalConstructor()
135 $utilHelper = $this->getMockBuilder(ilCertificateUtilHelper::class)
136 ->disableOriginalConstructor()
139 $utilHelper->method(
'prepareFormOutput')
140 ->willReturnCallback(
function ($input) {
144 $userDefinePlaceholderMock = $this->getMockBuilder(ilUserDefinedFieldsPlaceholderValues::class)
145 ->disableOriginalConstructor()
148 $userDefinePlaceholderMock->method(
'getPlaceholderValues')
151 $userDefinePlaceholderMock->method(
'getPlaceholderValuesForPreview')
154 $uuid_factory_mock = $this->getMockBuilder(
ILIAS\Data\UUID\Factory::class)
156 $uuid_factory_mock->method(
'uuid4AsString')->willReturn(
'randomUniqueString');
165 $userDefinePlaceholderMock,
169 $placeHolderObject->setUserLanguage($language);
171 $result = $placeHolderObject->getPlaceholderValues(100, 200);
175 'CERTIFICATE_ID' =>
'',
176 'USER_LOGIN' =>
'a_login',
177 'USER_FULLNAME' =>
'Niels Theen',
178 'USER_FIRSTNAME' =>
'Niels',
179 'USER_LASTNAME' =>
'Theen',
181 'USER_SALUTATION' =>
'Something',
182 'USER_BIRTHDAY' =>
'2018-09-10',
183 'USER_INSTITUTION' =>
'',
184 'USER_DEPARTMENT' =>
'',
187 'USER_ZIPCODE' =>
'',
188 'USER_COUNTRY' =>
'',
189 'USER_MATRICULATION' =>
'',
190 'DATE_COMPLETED' =>
'',
191 'DATETIME_COMPLETED' =>
'',
192 'DATE' =>
'2018-09-10',
193 'DATETIME' =>
'2018-09-10 12:01:33'
201 $objectHelper = $this->getMockBuilder(ilCertificateObjectHelper::class)
204 $dateHelper = $this->getMockBuilder(ilCertificateDateHelper::class)
207 $dateHelper->method(
'formatDate')
208 ->willReturn(
'2018-09-09');
210 $dateHelper->method(
'formatDateTime')
211 ->willReturn(
'2018-09-09 14:00:30');
213 $language = $this->getMockBuilder(ilLanguage::class)
214 ->disableOriginalConstructor()
217 $language->method(
'txt')
218 ->willReturn(
'Something');
220 $profile = $this->getMockBuilder(Profile::class)
221 ->disableOriginalConstructor()
224 $utilHelper = $this->getMockBuilder(ilCertificateUtilHelper::class)
225 ->disableOriginalConstructor()
228 $utilHelper->method(
'prepareFormOutput')
229 ->willReturnCallback(
function ($input) {
233 $userDefinePlaceholderMock = $this->getMockBuilder(ilUserDefinedFieldsPlaceholderValues::class)
234 ->disableOriginalConstructor()
237 $userDefinePlaceholderMock->method(
'getPlaceholderValues')
240 $userDefinePlaceholderMock->method(
'getPlaceholderValuesForPreview')
243 $uuid_factory_mock = $this->getMockBuilder(
ILIAS\Data\UUID\Factory::class)
245 $uuid_factory_mock->method(
'uuid4AsString')->willReturn(
'randomUniqueString');
254 $userDefinePlaceholderMock,
259 $result = $placeHolderObject->getPlaceholderValuesForPreview(
266 'CERTIFICATE_ID' =>
'randomUniqueString',
267 'USER_LOGIN' =>
'Something',
268 'USER_FULLNAME' =>
'Something',
269 'USER_FIRSTNAME' =>
'Something',
270 'USER_LASTNAME' =>
'Something',
271 'USER_TITLE' =>
'Something',
272 'USER_SALUTATION' =>
'Something',
273 'USER_BIRTHDAY' =>
'2018-09-09',
274 'USER_INSTITUTION' =>
'Something',
275 'USER_DEPARTMENT' =>
'Something',
276 'USER_STREET' =>
'Something',
277 'USER_CITY' =>
'Something',
278 'USER_ZIPCODE' =>
'Something',
279 'USER_COUNTRY' =>
'Something',
280 'USER_MATRICULATION' =>
'Something',
281 'DATE' =>
'2018-09-09',
282 'DATETIME' =>
'2018-09-09 14:00:30',
283 'DATE_COMPLETED' =>
'2018-09-09',
284 'DATETIME_COMPLETED' =>
'2018-09-09 14:00:30'
testGetPlaceholderValuesForPreview()
testGetPlaceholderValues()
Collection of basic placeholder values that can be used.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.