11 $queueRepository = $this->getMockBuilder(
'ilCertificateQueueRepository')
12 ->disableOriginalConstructor()
15 $templateRepository = $this->getMockBuilder(
'ilCertificateTemplateRepository')
16 ->disableOriginalConstructor()
19 $userRepository = $this->getMockBuilder(
'ilUserCertificateRepository')
20 ->disableOriginalConstructor()
23 $valueReplacement = $this->getMockBuilder(
'ilCertificateValueReplacement')
24 ->disableOriginalConstructor()
27 $logger = $this->getMockBuilder(
'ilLogger')
28 ->disableOriginalConstructor()
31 $languageMock = $this->getMockBuilder(
'ilLanguage')
32 ->disableOriginalConstructor()
36 ->expects($this->atLeastOnce())
38 ->willReturn(
'SomeTitle');
40 $dic = $this->getMockBuilder(
'\ILIAS\DI\Container')
41 ->disableOriginalConstructor()
44 $dic->method(
'language')
45 ->willReturn($languageMock);
47 $configValues = array(
'lng');
49 $dic->expects($this->any())
51 ->will($this->returnCallback(
52 function (
$key) use ($configValues) {
53 return $configValues[
$key];
57 $dic[
'lng'] = $languageMock;
71 $this->assertEquals(
'SomeTitle',
$title);
76 $queueRepository = $this->getMockBuilder(
'ilCertificateQueueRepository')
77 ->disableOriginalConstructor()
80 $templateRepository = $this->getMockBuilder(
'ilCertificateTemplateRepository')
81 ->disableOriginalConstructor()
84 $userRepository = $this->getMockBuilder(
'ilUserCertificateRepository')
85 ->disableOriginalConstructor()
88 $valueReplacement = $this->getMockBuilder(
'ilCertificateValueReplacement')
89 ->disableOriginalConstructor()
92 $logger = $this->getMockBuilder(
'ilLogger')
93 ->disableOriginalConstructor()
96 $languageMock = $this->getMockBuilder(
'ilLanguage')
97 ->disableOriginalConstructor()
101 ->expects($this->atLeastOnce())
103 ->willReturn(
'SomeDescription');
105 $dic = $this->getMockBuilder(
'\ILIAS\DI\Container')
106 ->disableOriginalConstructor()
109 $dic->method(
'language')
110 ->willReturn($languageMock);
112 $configValues = array(
'lng');
114 $dic->expects($this->any())
115 ->method(
'offsetGet')
116 ->will($this->returnCallback(
117 function (
$key) use ($configValues) {
118 return $configValues[
$key];
122 $dic[
'lng'] = $languageMock;
136 $this->assertEquals(
'SomeDescription',
$title);
141 $database = $this->getMockBuilder(
'ilDBInterface')
142 ->disableOriginalConstructor()
145 $queueRepository = $this->getMockBuilder(
'ilCertificateQueueRepository')
146 ->disableOriginalConstructor()
149 $templateRepository = $this->getMockBuilder(
'ilCertificateTemplateRepository')
150 ->disableOriginalConstructor()
153 $userRepository = $this->getMockBuilder(
'ilUserCertificateRepository')
154 ->disableOriginalConstructor()
157 $valueReplacement = $this->getMockBuilder(
'ilCertificateValueReplacement')
158 ->disableOriginalConstructor()
161 $logger = $this->getMockBuilder(
'ilLogger')
162 ->disableOriginalConstructor()
165 $languageMock = $this->getMockBuilder(
'ilLanguage')
166 ->disableOriginalConstructor()
169 $dic = $this->getMockBuilder(
'\ILIAS\DI\Container')
170 ->disableOriginalConstructor()
173 $dic->method(
'language')
174 ->willReturn($languageMock);
176 $dic->method(
'database')
177 ->willReturn($database);
179 $configValues = array(
'lng');
181 $dic->expects($this->any())
182 ->method(
'offsetGet')
183 ->will($this->returnCallback(
184 function (
$key) use ($configValues) {
185 return $configValues[
$key];
189 $dic[
'lng'] = $languageMock;
191 $objectMock = $this->getMockBuilder(
'ilObject')
192 ->disableOriginalConstructor()
195 $userMock = $this->getMockBuilder(
'ilObjUser')
196 ->disableOriginalConstructor()
199 $objectHelper = $this->getMockBuilder(
'ilCertificateObjectHelper')
200 ->disableOriginalConstructor()
203 $objectHelper->method(
'getInstanceByObjId')
204 ->willReturnOnConsecutiveCalls(
222 $this->assertEquals(
'certificate',
$id);
227 $database = $this->getMockBuilder(
'ilDBInterface')
228 ->disableOriginalConstructor()
231 $queueRepository = $this->getMockBuilder(
'ilCertificateQueueRepository')
232 ->disableOriginalConstructor()
235 $templateRepository = $this->getMockBuilder(
'ilCertificateTemplateRepository')
236 ->disableOriginalConstructor()
239 $userRepository = $this->getMockBuilder(
'ilUserCertificateRepository')
240 ->disableOriginalConstructor()
243 $valueReplacement = $this->getMockBuilder(
'ilCertificateValueReplacement')
244 ->disableOriginalConstructor()
247 $logger = $this->getMockBuilder(
'ilLogger')
248 ->disableOriginalConstructor()
251 $languageMock = $this->getMockBuilder(
'ilLanguage')
252 ->disableOriginalConstructor()
255 $dic = $this->getMockBuilder(
'\ILIAS\DI\Container')
256 ->disableOriginalConstructor()
259 $dic->method(
'language')
260 ->willReturn($languageMock);
262 $dic->method(
'database')
263 ->willReturn($database);
265 $configValues = array(
'lng');
267 $dic->expects($this->any())
268 ->method(
'offsetGet')
269 ->will($this->returnCallback(
270 function (
$key) use ($configValues) {
271 return $configValues[
$key];
275 $dic[
'lng'] = $languageMock;
277 $objectMock = $this->getMockBuilder(
'ilObject')
278 ->disableOriginalConstructor()
281 $userMock = $this->getMockBuilder(
'ilObjUser')
282 ->disableOriginalConstructor()
285 $objectHelper = $this->getMockBuilder(
'ilCertificateObjectHelper')
286 ->disableOriginalConstructor()
289 $objectHelper->method(
'getInstanceByObjId')
290 ->willReturnOnConsecutiveCalls(
306 $activation =
$cron->hasAutoActivation();
308 $this->assertTrue($activation);
313 $database = $this->getMockBuilder(
'ilDBInterface')
314 ->disableOriginalConstructor()
317 $queueRepository = $this->getMockBuilder(
'ilCertificateQueueRepository')
318 ->disableOriginalConstructor()
321 $templateRepository = $this->getMockBuilder(
'ilCertificateTemplateRepository')
322 ->disableOriginalConstructor()
325 $userRepository = $this->getMockBuilder(
'ilUserCertificateRepository')
326 ->disableOriginalConstructor()
329 $valueReplacement = $this->getMockBuilder(
'ilCertificateValueReplacement')
330 ->disableOriginalConstructor()
333 $logger = $this->getMockBuilder(
'ilLogger')
334 ->disableOriginalConstructor()
337 $languageMock = $this->getMockBuilder(
'ilLanguage')
338 ->disableOriginalConstructor()
341 $dic = $this->getMockBuilder(
'\ILIAS\DI\Container')
342 ->disableOriginalConstructor()
345 $dic->method(
'language')
346 ->willReturn($languageMock);
348 $dic->method(
'database')
349 ->willReturn($database);
351 $configValues = array(
'lng');
353 $dic->expects($this->any())
354 ->method(
'offsetGet')
355 ->will($this->returnCallback(
356 function (
$key) use ($configValues) {
357 return $configValues[
$key];
361 $dic[
'lng'] = $languageMock;
363 $objectMock = $this->getMockBuilder(
'ilObject')
364 ->disableOriginalConstructor()
367 $userMock = $this->getMockBuilder(
'ilObjUser')
368 ->disableOriginalConstructor()
371 $objectHelper = $this->getMockBuilder(
'ilCertificateObjectHelper')
372 ->disableOriginalConstructor()
375 $objectHelper->method(
'getInstanceByObjId')
376 ->willReturnOnConsecutiveCalls(
392 $flexibleSchedule =
$cron->hasFlexibleSchedule();
394 $this->assertTrue($flexibleSchedule);
399 $database = $this->getMockBuilder(
'ilDBInterface')
400 ->disableOriginalConstructor()
403 $queueRepository = $this->getMockBuilder(
'ilCertificateQueueRepository')
404 ->disableOriginalConstructor()
407 $templateRepository = $this->getMockBuilder(
'ilCertificateTemplateRepository')
408 ->disableOriginalConstructor()
411 $userRepository = $this->getMockBuilder(
'ilUserCertificateRepository')
412 ->disableOriginalConstructor()
415 $valueReplacement = $this->getMockBuilder(
'ilCertificateValueReplacement')
416 ->disableOriginalConstructor()
419 $logger = $this->getMockBuilder(
'ilLogger')
420 ->disableOriginalConstructor()
423 $languageMock = $this->getMockBuilder(
'ilLanguage')
424 ->disableOriginalConstructor()
427 $dic = $this->getMockBuilder(
'\ILIAS\DI\Container')
428 ->disableOriginalConstructor()
431 $dic->method(
'language')
432 ->willReturn($languageMock);
434 $dic->method(
'database')
435 ->willReturn($database);
437 $configValues = array(
'lng');
439 $dic->expects($this->any())
440 ->method(
'offsetGet')
441 ->will($this->returnCallback(
442 function (
$key) use ($configValues) {
443 return $configValues[
$key];
447 $dic[
'lng'] = $languageMock;
449 $objectMock = $this->getMockBuilder(
'ilObject')
450 ->disableOriginalConstructor()
453 $userMock = $this->getMockBuilder(
'ilObjUser')
454 ->disableOriginalConstructor()
457 $objectHelper = $this->getMockBuilder(
'ilCertificateObjectHelper')
458 ->disableOriginalConstructor()
461 $objectHelper->method(
'getInstanceByObjId')
462 ->willReturnOnConsecutiveCalls(
478 $flexibleSchedule =
$cron->getDefaultScheduleType();
480 $this->assertEquals(2, $flexibleSchedule);
485 $database = $this->getMockBuilder(
'ilDBInterface')
486 ->disableOriginalConstructor()
489 $queueRepository = $this->getMockBuilder(
'ilCertificateQueueRepository')
490 ->disableOriginalConstructor()
493 $templateRepository = $this->getMockBuilder(
'ilCertificateTemplateRepository')
494 ->disableOriginalConstructor()
497 $userRepository = $this->getMockBuilder(
'ilUserCertificateRepository')
498 ->disableOriginalConstructor()
501 $valueReplacement = $this->getMockBuilder(
'ilCertificateValueReplacement')
502 ->disableOriginalConstructor()
505 $logger = $this->getMockBuilder(
'ilLogger')
506 ->disableOriginalConstructor()
509 $languageMock = $this->getMockBuilder(
'ilLanguage')
510 ->disableOriginalConstructor()
513 $dic = $this->getMockBuilder(
'\ILIAS\DI\Container')
514 ->disableOriginalConstructor()
517 $dic->method(
'language')
518 ->willReturn($languageMock);
520 $dic->method(
'database')
521 ->willReturn($database);
523 $configValues = array(
'lng');
525 $dic->expects($this->any())
526 ->method(
'offsetGet')
527 ->will($this->returnCallback(
528 function (
$key) use ($configValues) {
529 return $configValues[
$key];
533 $dic[
'lng'] = $languageMock;
535 $objectMock = $this->getMockBuilder(
'ilObject')
536 ->disableOriginalConstructor()
539 $userMock = $this->getMockBuilder(
'ilObjUser')
540 ->disableOriginalConstructor()
543 $objectHelper = $this->getMockBuilder(
'ilCertificateObjectHelper')
544 ->disableOriginalConstructor()
547 $objectHelper->method(
'getInstanceByObjId')
548 ->willReturnOnConsecutiveCalls(
564 $scheduleValue =
$cron->getDefaultScheduleValue();
566 $this->assertEquals(1, $scheduleValue);
testGetDefaultScheduleType()
if(!array_key_exists('StateId', $_REQUEST)) $id
testGetDefaultScheduleValue()