◆ fetchFirstCreateTemplate()
ilCertificateTemplateRepositoryTest::fetchFirstCreateTemplate |
( |
| ) |
|
Definition at line 430 of file ilCertificateTemplateRepositoryTest.php.
432 $database = $this->createMock(ilDBInterface::class);
434 $logger = $this->getMockBuilder(ilLogger::class)
435 ->disableOriginalConstructor()
438 $database->method(
'quote')
439 ->with(10,
'integer')
442 $objectDataCache = $this->getMockBuilder(ilObjectDataCache::class)
443 ->disableOriginalConstructor()
446 $database->method(
'fetchAssoc')
449 $database->method(
'fetchAssoc')->willReturn(
454 'certificate_content' =>
'<xml>Some Content</xml>',
455 'certificate_hash' => md5(
'<xml>Some Content</xml>'),
456 'template_values' =>
'[]',
458 'ilias_version' =>
'v5.4.0',
459 'created_timestamp' => 123456789,
460 'currently_active' =>
true,
461 'background_image_path' =>
'/some/where/background.jpg' 467 $firstTemplate = $repository->fetchFirstCreatedTemplate(10);
469 $this->assertSame(1, $firstTemplate->getId());
◆ testActivatePreviousCertificate()
ilCertificateTemplateRepositoryTest::testActivatePreviousCertificate |
( |
| ) |
|
Definition at line 279 of file ilCertificateTemplateRepositoryTest.php.
281 $database = $this->createMock(ilDBInterface::class);
283 $logger = $this->getMockBuilder(ilLogger::class)
284 ->disableOriginalConstructor()
287 $database->method(
'quote')
288 ->withConsecutive([10,
'integer'], [30,
'integer'])
289 ->willReturnOnConsecutiveCalls(
'10',
'30');
291 $database->method(
'fetchAssoc')->willReturnOnConsecutiveCalls(
296 'certificate_content' =>
'<xml>Some Content</xml>',
297 'certificate_hash' => md5(
'<xml>Some Content</xml>'),
298 'template_values' =>
'[]',
300 'ilias_version' =>
'v5.4.0',
301 'created_timestamp' => 123456789,
302 'currently_active' =>
true,
303 'background_image_path' =>
'/some/where/background.jpg',
304 'thumbnail_image_path' =>
'some/path/test.svg' 310 'certificate_content' =>
'<xml>Some Other Content</xml>',
311 'certificate_hash' => md5(
'<xml>Some Content</xml>'),
312 'template_values' =>
'[]',
314 'ilias_version' =>
'v5.3.0',
315 'created_timestamp' => 123456789,
316 'currently_active' =>
false,
317 'background_image_path' =>
'/some/where/else/background.jpg',
318 'thumbnail_image_path' =>
'some/path/test.svg' 322 $database->method(
'query')
326 'UPDATE il_cert_template 327 SET currently_active = 1 332 $objectDataCache = $this->getMockBuilder(ilObjectDataCache::class)
333 ->disableOriginalConstructor()
336 $objectDataCache->method(
'lookUpType')->willReturn(
'crs');
340 $template = $repository->activatePreviousCertificate(10);
342 $this->assertSame(30, $template->getId());
◆ testCertificateWillBeSavedToTheDatabase()
ilCertificateTemplateRepositoryTest::testCertificateWillBeSavedToTheDatabase |
( |
| ) |
|
Definition at line 26 of file ilCertificateTemplateRepositoryTest.php.
28 $database = $this->createMock(ilDBInterface::class);
30 $logger = $this->getMockBuilder(ilLogger::class)
31 ->disableOriginalConstructor()
34 $objectDataCache = $this->getMockBuilder(ilObjectDataCache::class)
35 ->disableOriginalConstructor()
38 $objectDataCache->method(
'lookUpType')->willReturn(
'crs');
40 $database->method(
'nextId')
43 $database->method(
'insert')
47 'id' => [
'integer', 10],
48 'obj_id' => [
'integer', 100],
49 'obj_type' => [
'text',
'crs'],
50 'certificate_content' => [
'clob',
'<xml>Some Content</xml>'],
51 'certificate_hash' => [
'text', md5(
'<xml>Some Content</xml>')],
52 'template_values' => [
'clob',
'[]'],
53 'version' => [
'integer', 1],
54 'ilias_version' => [
'text',
'v5.4.0'],
55 'created_timestamp' => [
'integer', 123456789],
56 'currently_active' => [
'integer',
true],
57 'background_image_path' => [
'text',
'/some/where/background.jpg'],
58 'deleted' => [
'integer', 0],
59 'thumbnail_image_path' => [
'text',
'some/path/test.svg']
63 $logger->expects($this->atLeastOnce())
69 '<xml>Some Content</xml>',
70 md5(
'<xml>Some Content</xml>'),
76 $backgroundImagePath =
'/some/where/background.jpg',
82 $repository->save($template);
◆ testDeleteTemplateFromDatabase()
ilCertificateTemplateRepositoryTest::testDeleteTemplateFromDatabase |
( |
| ) |
|
Definition at line 250 of file ilCertificateTemplateRepositoryTest.php.
252 $database = $this->createMock(ilDBInterface::class);
254 $logger = $this->getMockBuilder(ilLogger::class)
255 ->disableOriginalConstructor()
258 $database->method(
'quote')
259 ->withConsecutive([10,
'integer'], [200,
'integer'])
260 ->willReturnOnConsecutiveCalls(
'10',
'200');
262 $database->method(
'query')
264 DELETE FROM il_cert_template 268 $objectDataCache = $this->getMockBuilder(ilObjectDataCache::class)
269 ->disableOriginalConstructor()
272 $objectDataCache->method(
'lookUpType')->willReturn(
'crs');
276 $repository->deleteTemplate(10, 200);
◆ testFetchAllObjectIdsByType()
ilCertificateTemplateRepositoryTest::testFetchAllObjectIdsByType |
( |
| ) |
|
Definition at line 345 of file ilCertificateTemplateRepositoryTest.php.
347 $database = $this->createMock(ilDBInterface::class);
349 $logger = $this->getMockBuilder(ilLogger::class)
350 ->disableOriginalConstructor()
353 $objectDataCache = $this->getMockBuilder(ilObjectDataCache::class)
354 ->disableOriginalConstructor()
357 $database->method(
'fetchAssoc')->willReturnOnConsecutiveCalls(
362 'certificate_content' =>
'<xml>Some Content</xml>',
363 'certificate_hash' => md5(
'<xml>Some Content</xml>'),
364 'template_values' =>
'[]',
366 'ilias_version' =>
'v5.4.0',
367 'created_timestamp' => 123456789,
368 'currently_active' =>
true,
369 'background_image_path' =>
'/some/where/background.jpg',
370 'thumbnail_image_path' =>
'/some/where/thumbnail.svg' 376 'certificate_content' =>
'<xml>Some Other Content</xml>',
377 'certificate_hash' => md5(
'<xml>Some Content</xml>'),
378 'template_values' =>
'[]',
380 'ilias_version' =>
'v5.3.0',
381 'created_timestamp' => 123456789,
382 'currently_active' =>
false,
383 'background_image_path' =>
'/some/where/else/background.jpg',
384 'thumbnail_image_path' =>
'/some/where/thumbnail.svg' 390 $templates = $repository->fetchActiveCertificateTemplatesForCoursesWithDisabledLearningProgress(
true);
392 $this->assertSame(10, $templates[0]->getObjId());
393 $this->assertSame(30, $templates[1]->getObjId());
◆ testFetchCertificateTemplatesByObjId()
ilCertificateTemplateRepositoryTest::testFetchCertificateTemplatesByObjId |
( |
| ) |
|
Definition at line 85 of file ilCertificateTemplateRepositoryTest.php.
References ILIAS\Survey\Mode\getId().
87 $database = $this->createMock(ilDBInterface::class);
89 $logger = $this->getMockBuilder(ilLogger::class)
90 ->disableOriginalConstructor()
93 $database->method(
'fetchAssoc')
94 ->willReturnOnConsecutiveCalls(
99 'certificate_content' =>
'<xml>Some Content</xml>',
100 'certificate_hash' => md5(
'<xml>Some Content</xml>'),
101 'template_values' =>
'[]',
103 'ilias_version' =>
'v5.4.0',
104 'created_timestamp' => 123456789,
105 'currently_active' =>
true,
106 'background_image_path' =>
'/some/where/background.jpg',
107 'thumbnail_image_path' =>
'some/path/test.svg' 113 'certificate_content' =>
'<xml>Some Other Content</xml>',
114 'certificate_hash' => md5(
'<xml>Some Content</xml>'),
115 'template_values' =>
'[]',
117 'ilias_version' =>
'v5.3.0',
118 'created_timestamp' => 123456789,
119 'currently_active' =>
false,
120 'background_image_path' =>
'/some/where/else/background.jpg',
121 'thumbnail_image_path' =>
'some/path/test.svg' 125 $objectDataCache = $this->getMockBuilder(ilObjectDataCache::class)
126 ->disableOriginalConstructor()
129 $objectDataCache->method(
'lookUpType')->willReturn(
'crs');
133 $templates = $repository->fetchCertificateTemplatesByObjId(10);
135 $this->assertSame(1, $templates[0]->
getId());
136 $this->assertSame(30, $templates[1]->
getId());
◆ testFetchCurrentlyActiveCertificate()
ilCertificateTemplateRepositoryTest::testFetchCurrentlyActiveCertificate |
( |
| ) |
|
Definition at line 139 of file ilCertificateTemplateRepositoryTest.php.
141 $database = $this->createMock(ilDBInterface::class);
143 $logger = $this->getMockBuilder(ilLogger::class)
144 ->disableOriginalConstructor()
147 $database->method(
'fetchAssoc')
148 ->willReturnOnConsecutiveCalls(
153 'certificate_content' =>
'<xml>Some Content</xml>',
154 'certificate_hash' => md5(
'<xml>Some Content</xml>'),
155 'template_values' =>
'[]',
157 'ilias_version' =>
'v5.4.0',
158 'created_timestamp' => 123456789,
159 'currently_active' =>
true,
160 'background_image_path' =>
'/some/where/background.jpg',
161 'thumbnail_image_path' =>
'some/path/test.svg' 167 'certificate_content' =>
'<xml>Some Other Content</xml>',
168 'certificate_hash' => md5(
'<xml>Some Content</xml>'),
169 'template_values' =>
'[]',
171 'ilias_version' =>
'v5.3.0',
172 'created_timestamp' => 123456789,
173 'currently_active' =>
false,
174 'background_image_path' =>
'/some/where/else/background.jpg',
175 'thumbnail_image_path' =>
'some/path/test.svg' 179 $objectDataCache = $this->getMockBuilder(ilObjectDataCache::class)
180 ->disableOriginalConstructor()
183 $objectDataCache->method(
'lookUpType')->willReturn(
'crs');
187 $template = $repository->fetchCurrentlyActiveCertificate(10);
189 $this->assertSame(1, $template->getId());
◆ testFetchFirstCreatedTemplateFailsBecauseNothingWasSaved()
ilCertificateTemplateRepositoryTest::testFetchFirstCreatedTemplateFailsBecauseNothingWasSaved |
( |
| ) |
|
Definition at line 399 of file ilCertificateTemplateRepositoryTest.php.
401 $this->expectException(ilException::class);
403 $database = $this->createMock(ilDBInterface::class);
405 $logger = $this->getMockBuilder(ilLogger::class)
406 ->disableOriginalConstructor()
409 $database->method(
'quote')
410 ->with(10,
'integer')
413 $objectDataCache = $this->getMockBuilder(ilObjectDataCache::class)
414 ->disableOriginalConstructor()
417 $database->method(
'fetchAssoc')
420 $database->method(
'fetchAssoc')
425 $repository->fetchFirstCreatedTemplate(10);
◆ testFetchPreviousCertificate()
ilCertificateTemplateRepositoryTest::testFetchPreviousCertificate |
( |
| ) |
|
Definition at line 192 of file ilCertificateTemplateRepositoryTest.php.
194 $database = $this->getMockBuilder(ilDBInterface::class)
195 ->disableOriginalConstructor()
198 $logger = $this->getMockBuilder(ilLogger::class)
199 ->disableOriginalConstructor()
202 $database->method(
'fetchAssoc')
203 ->willReturnOnConsecutiveCalls(
208 'certificate_content' =>
'<xml>Some Content</xml>',
209 'certificate_hash' => md5(
'<xml>Some Content</xml>'),
210 'template_values' =>
'[]',
212 'ilias_version' =>
'v5.4.0',
213 'created_timestamp' => 123456789,
214 'currently_active' =>
true,
215 'background_image_path' =>
'/some/where/background.jpg',
216 'thumbnail_image_path' =>
'some/path/test.svg' 222 'certificate_content' =>
'<xml>Some Other Content</xml>',
223 'certificate_hash' => md5(
'<xml>Some Content</xml>'),
224 'template_values' =>
'[]',
226 'ilias_version' =>
'v5.3.0',
227 'created_timestamp' => 123456789,
228 'currently_active' =>
false,
229 'background_image_path' =>
'/some/where/else/background.jpg',
230 'thumbnail_image_path' =>
'some/path/test.svg' 234 $objectDataCache = $this->getMockBuilder(ilObjectDataCache::class)
235 ->disableOriginalConstructor()
238 $objectDataCache->method(
'lookUpType')->willReturn(
'crs');
242 $template = $repository->fetchPreviousCertificate(10);
244 $this->assertSame(30, $template->getId());
The documentation for this class was generated from the following file: