◆ testFetchActiveCertificateForUserObjectCombination()
ilUserCertificateRepositoryTest::testFetchActiveCertificateForUserObjectCombination |
( |
| ) |
|
Definition at line 152 of file ilUserCertificateRepositoryTest.php.
154 $database = $this->createMock(ilDBInterface::class);
156 $database->method(
'nextId')
159 $database->method(
'fetchAssoc')->willReturnOnConsecutiveCalls(
162 'pattern_certificate_id' => 1,
166 'user_name' =>
'Niels Theen',
167 'acquired_timestamp' => 123456789,
168 'certificate_content' =>
'<xml>Some Content</xml>',
169 'template_values' =>
'[]',
170 'valid_until' => null,
172 'ilias_version' =>
'v5.4.0',
173 'currently_active' =>
true,
174 'background_image_path' =>
'/some/where/background.jpg',
175 'thumbnail_image_path' =>
'/some/where/thumbnail.svg',
179 'pattern_certificate_id' => 5,
183 'user_name' =>
'Niels Theen',
184 'acquired_timestamp' => 987654321,
185 'certificate_content' =>
'<xml>Some Other Content</xml>',
186 'template_values' =>
'[]',
187 'valid_until' => null,
189 'ilias_version' =>
'v5.3.0',
190 'currently_active' =>
true,
191 'background_image_path' =>
'/some/where/else/background.jpg',
192 'thumbnail_image_path' =>
'/some/where/thumbnail.svg',
196 $logger = $this->getMockBuilder(ilLogger::class)
197 ->disableOriginalConstructor()
200 $logger->expects($this->atLeastOnce())
209 $result = $repository->fetchActiveCertificate(400, 20);
211 $this->assertSame(141, $result->getId());
◆ testFetchActiveCertificatesByType()
ilUserCertificateRepositoryTest::testFetchActiveCertificatesByType |
( |
| ) |
|
Definition at line 242 of file ilUserCertificateRepositoryTest.php.
References $results, and ILIAS\Survey\Mode\getId().
244 $database = $this->createMock(ilDBInterface::class);
246 $database->method(
'nextId')
249 $database->method(
'fetchAssoc')->willReturnOnConsecutiveCalls(
252 'pattern_certificate_id' => 1,
256 'user_name' =>
'Niels Theen',
257 'acquired_timestamp' => 123456789,
258 'certificate_content' =>
'<xml>Some Content</xml>',
259 'template_values' =>
'[]',
260 'valid_until' => null,
262 'ilias_version' =>
'v5.4.0',
263 'currently_active' =>
true,
264 'background_image_path' =>
'/some/where/background.jpg',
265 'thumbnail_image_path' =>
'/some/where/else/thumbnail.svg',
266 'title' =>
'SomeTitle',
267 'someDescription' =>
'SomeDescription' 271 'pattern_certificate_id' => 5,
275 'user_name' =>
'Niels Theen',
276 'acquired_timestamp' => 987654321,
277 'certificate_content' =>
'<xml>Some Other Content</xml>',
278 'template_values' =>
'[]',
279 'valid_until' => null,
281 'ilias_version' =>
'v5.3.0',
282 'currently_active' =>
true,
283 'background_image_path' =>
'/some/where/else/background.jpg',
284 'thumbnail_image_path' =>
'/some/where/else/thumbnail.svg',
285 'title' =>
'SomeTitle',
286 'someDescription' =>
'SomeDescription' 290 $logger = $this->getMockBuilder(ilLogger::class)
291 ->disableOriginalConstructor()
294 $logger->expects($this->atLeastOnce())
299 $results = $repository->fetchActiveCertificatesByTypeForPresentation(400,
'crs');
301 $this->assertSame(141,
$results[0]->getUserCertificate()->
getId());
302 $this->assertSame(142,
$results[1]->getUserCertificate()->
getId());
◆ testFetchAllActiveCertificateForUser()
ilUserCertificateRepositoryTest::testFetchAllActiveCertificateForUser |
( |
| ) |
|
Definition at line 87 of file ilUserCertificateRepositoryTest.php.
References $results, and ILIAS\Survey\Mode\getId().
89 $database = $this->createMock(ilDBInterface::class);
91 $database->method(
'nextId')
94 $database->method(
'fetchAssoc')->willReturnOnConsecutiveCalls(
97 'pattern_certificate_id' => 1,
101 'user_name' =>
'Niels Theen',
102 'acquired_timestamp' => 123456789,
103 'certificate_content' =>
'<xml>Some Content</xml>',
104 'template_values' =>
'[]',
105 'valid_until' => null,
107 'ilias_version' =>
'v5.4.0',
108 'currently_active' =>
true,
109 'background_image_path' =>
'/some/where/background.jpg',
110 'thumbnail_image_path' =>
'/some/where/thumbnail.svg',
111 'title' =>
'Some Title' 115 'pattern_certificate_id' => 5,
119 'user_name' =>
'Niels Theen',
120 'acquired_timestamp' => 987654321,
121 'certificate_content' =>
'<xml>Some Other Content</xml>',
122 'template_values' =>
'[]',
123 'valid_until' => null,
125 'ilias_version' =>
'v5.3.0',
126 'currently_active' =>
true,
127 'background_image_path' =>
'/some/where/else/background.jpg',
128 'thumbnail_image_path' =>
'/some/where/thumbnail.svg',
129 'title' =>
'Someother Title' 133 $logger = $this->getMockBuilder(ilLogger::class)
134 ->disableOriginalConstructor()
137 $logger->expects($this->atLeastOnce())
146 $results = $repository->fetchActiveCertificates(400);
148 $this->assertSame(141,
$results[0]->getUserCertificate()->
getId());
149 $this->assertSame(142,
$results[1]->getUserCertificate()->
getId());
◆ testFetchCertificate()
ilUserCertificateRepositoryTest::testFetchCertificate |
( |
| ) |
|
Definition at line 305 of file ilUserCertificateRepositoryTest.php.
307 $database = $this->createMock(ilDBInterface::class);
309 $database->method(
'nextId')
312 $database->method(
'fetchAssoc')->willReturn(
315 'pattern_certificate_id' => 1,
319 'user_name' =>
'Niels Theen',
320 'acquired_timestamp' => 123456789,
321 'certificate_content' =>
'<xml>Some Content</xml>',
322 'template_values' =>
'[]',
323 'valid_until' => null,
325 'ilias_version' =>
'v5.4.0',
326 'currently_active' =>
true,
327 'background_image_path' =>
'/some/where/background.jpg',
328 'thumbnail_image_path' =>
'/some/where/else/thumbnail.svg',
329 'title' =>
'SomeTitle',
330 'someDescription' =>
'SomeDescription' 334 $logger = $this->getMockBuilder(ilLogger::class)
335 ->disableOriginalConstructor()
338 $logger->expects($this->atLeastOnce())
343 $result = $repository->fetchCertificate(141);
345 $this->assertSame(141, $result->getId());
◆ testFetchNoActiveCertificateLeadsToException()
ilUserCertificateRepositoryTest::testFetchNoActiveCertificateLeadsToException |
( |
| ) |
|
Definition at line 217 of file ilUserCertificateRepositoryTest.php.
219 $this->expectException(ilException::class);
221 $database = $this->createMock(ilDBInterface::class);
223 $database->method(
'nextId')
226 $database->method(
'fetchAssoc')->willReturn([]);
228 $logger = $this->getMockBuilder(ilLogger::class)
229 ->disableOriginalConstructor()
232 $logger->expects($this->atLeastOnce())
237 $repository->fetchActiveCertificate(400, 20);
239 $this->fail(
'Should never happen. Certificate Found?');
◆ testFetchObjectWithCertificateForUser()
ilUserCertificateRepositoryTest::testFetchObjectWithCertificateForUser |
( |
| ) |
|
Definition at line 374 of file ilUserCertificateRepositoryTest.php.
References $results.
376 $database = $this->createMock(ilDBInterface::class);
379 ->expects($this->once())
383 ->expects($this->once())
387 ->expects($this->exactly(3))
388 ->method(
'fetchAssoc')
389 ->willReturnOnConsecutiveCalls(
395 $database->method(
'fetchAssoc')
398 $logger = $this->getMockBuilder(ilLogger::class)
399 ->disableOriginalConstructor()
402 $logger->expects($this->atLeastOnce())
408 $objectIds = [200, 300, 400];
410 $results = $repository->fetchObjectIdsWithCertificateForUser($userId, $objectIds);
412 $this->assertSame([100, 300],
$results);
◆ testFetchUserIdsWithCertificateForObject()
ilUserCertificateRepositoryTest::testFetchUserIdsWithCertificateForObject |
( |
| ) |
|
Definition at line 415 of file ilUserCertificateRepositoryTest.php.
References $results.
417 $database = $this->createMock(ilDBInterface::class);
420 ->expects($this->once())
424 ->expects($this->exactly(3))
425 ->method(
'fetchAssoc')
426 ->willReturnOnConsecutiveCalls(
432 $database->method(
'fetchAssoc')
435 $logger = $this->getMockBuilder(ilLogger::class)
436 ->disableOriginalConstructor()
439 $logger->expects($this->atLeastOnce())
446 $results = $repository->fetchUserIdsWithCertificateForObject($objectId);
448 $this->assertSame([100, 300],
$results);
◆ testNoCertificateInFetchtCertificateLeadsToException()
ilUserCertificateRepositoryTest::testNoCertificateInFetchtCertificateLeadsToException |
( |
| ) |
|
Definition at line 348 of file ilUserCertificateRepositoryTest.php.
350 $this->expectException(ilException::class);
352 $database = $this->createMock(ilDBInterface::class);
354 $database->method(
'nextId')
357 $database->method(
'fetchAssoc')
360 $logger = $this->getMockBuilder(ilLogger::class)
361 ->disableOriginalConstructor()
364 $logger->expects($this->atLeastOnce())
369 $repository->fetchCertificate(141);
371 $this->fail(
'Should never happen. Certificate Found?');
◆ testSaveOfUserCertificateToDatabase()
ilUserCertificateRepositoryTest::testSaveOfUserCertificateToDatabase |
( |
| ) |
|
Definition at line 26 of file ilUserCertificateRepositoryTest.php.
28 $database = $this->createMock(ilDBInterface::class);
30 $database->method(
'nextId')
33 $database->method(
'insert')->with(
36 'id' => [
'integer', 141],
37 'pattern_certificate_id' => [
'integer', 1],
38 'obj_id' => [
'integer', 20],
39 'obj_type' => [
'text',
'crs'],
40 'usr_id' => [
'integer', 400],
41 'user_name' => [
'text',
'Niels Theen'],
42 'acquired_timestamp' => [
'integer', 123456789],
43 'certificate_content' => [
'clob',
'<xml>Some Content</xml>'],
44 'template_values' => [
'clob',
'[]'],
45 'valid_until' => [
'integer', null],
46 'version' => [
'integer', 1],
47 'ilias_version' => [
'text',
'v5.4.0'],
48 'currently_active' => [
'integer',
true],
49 'background_image_path' => [
'text',
'/some/where/background.jpg'],
50 'thumbnail_image_path' => [
'text',
'/some/where/thumbnail.svg'],
54 $logger = $this->getMockBuilder(ilLogger::class)
55 ->disableOriginalConstructor()
58 $logger->expects($this->atLeastOnce())
74 '<xml>Some Content</xml>',
80 '/some/where/background.jpg',
81 '/some/where/thumbnail.svg' 84 $repository->save($userCertificate);
The documentation for this class was generated from the following file: