◆ testFetchActiveCertificateForUserObjectCombination()
ilUserCertificateRepositoryTest::testFetchActiveCertificateForUserObjectCombination |
( |
| ) |
|
Definition at line 172 of file ilUserCertificateRepositoryTest.php.
References null.
174 $database = $this->createMock(ilDBInterface::class);
176 $database->method(
'nextId')
179 $database->method(
'fetchAssoc')->willReturnOnConsecutiveCalls(
182 'pattern_certificate_id' => 1,
186 'user_name' =>
'Niels Theen',
187 'acquired_timestamp' => 123_456_789,
188 'certificate_content' =>
'<xml>Some Content</xml>',
189 'template_values' =>
'[]',
190 'valid_until' =>
null,
192 'ilias_version' =>
'v5.4.0',
193 'currently_active' =>
true,
194 'background_image_path' =>
'/some/where/background.jpg',
195 'tile_image_path' =>
'/some/where/tile_image.svg',
196 'background_image_ident' =>
'-',
197 'tile_image_ident' =>
'-',
198 'certificate_id' =>
'11111111-2222-3333-4444-555555555555' 202 'pattern_certificate_id' => 5,
206 'user_name' =>
'Niels Theen',
207 'acquired_timestamp' => 987_654_321,
208 'certificate_content' =>
'<xml>Some Other Content</xml>',
209 'template_values' =>
'[]',
210 'valid_until' =>
null,
212 'ilias_version' =>
'v5.3.0',
213 'currently_active' =>
true,
214 'background_image_path' =>
'/some/where/else/background.jpg',
215 'tile_image_path' =>
'/some/where/tile_image.svg',
216 'background_image_ident' =>
'-',
217 'tile_image_ident' =>
'-',
218 'certificate_id' =>
'11111111-2222-3333-4444-555555555555' 222 $logger = $this->getMockBuilder(ilLogger::class)
223 ->disableOriginalConstructor()
226 $logger->expects($this->atLeastOnce())
235 $result = $repository->fetchActiveCertificate(400, 20);
237 $this->assertSame(141, $result->getId());
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
◆ testFetchActiveCertificatesByType()
ilUserCertificateRepositoryTest::testFetchActiveCertificatesByType |
( |
| ) |
|
Definition at line 265 of file ilUserCertificateRepositoryTest.php.
References $results, ILIAS\Survey\Mode\getId(), and null.
267 $database = $this->createMock(ilDBInterface::class);
269 $database->method(
'nextId')
272 $database->method(
'fetchAssoc')->willReturnOnConsecutiveCalls(
275 'pattern_certificate_id' => 1,
279 'user_name' =>
'Niels Theen',
280 'acquired_timestamp' => 123_456_789,
281 'certificate_content' =>
'<xml>Some Content</xml>',
282 'template_values' =>
'[]',
283 'valid_until' =>
null,
285 'ilias_version' =>
'v5.4.0',
286 'currently_active' =>
true,
287 'background_image_path' =>
'/some/where/background.jpg',
288 'tile_image_path' =>
'/some/where/else/tile_image.svg',
289 'background_image_ident' =>
'-',
290 'tile_image_ident' =>
'-',
291 'title' =>
'SomeTitle',
292 'someDescription' =>
'SomeDescription',
293 'certificate_id' =>
'11111111-2222-3333-4444-555555555555' 297 'pattern_certificate_id' => 5,
301 'user_name' =>
'Niels Theen',
302 'acquired_timestamp' => 987_654_321,
303 'certificate_content' =>
'<xml>Some Other Content</xml>',
304 'template_values' =>
'[]',
305 'valid_until' =>
null,
307 'ilias_version' =>
'v5.3.0',
308 'currently_active' =>
true,
309 'background_image_path' =>
'/some/where/else/background.jpg',
310 'tile_image_path' =>
'/some/where/else/tile_image.svg',
311 'background_image_ident' =>
'-',
312 'tile_image_ident' =>
'-',
313 'title' =>
'SomeTitle',
314 'someDescription' =>
'SomeDescription',
315 'certificate_id' =>
'11111111-2222-3333-4444-555555555555' 320 $logger = $this->getMockBuilder(ilLogger::class)
321 ->disableOriginalConstructor()
324 $logger->expects($this->atLeastOnce())
329 $results = $repository->fetchActiveCertificatesByTypeForPresentation(400,
'crs');
331 $this->assertSame(141,
$results[0]->getUserCertificate()->
getId());
332 $this->assertSame(142,
$results[1]->getUserCertificate()->
getId());
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
◆ testFetchAllActiveCertificateForUser()
ilUserCertificateRepositoryTest::testFetchAllActiveCertificateForUser |
( |
| ) |
|
Definition at line 100 of file ilUserCertificateRepositoryTest.php.
References $results, ILIAS\Survey\Mode\getId(), and null.
102 $database = $this->createMock(ilDBInterface::class);
104 $database->method(
'nextId')
107 $database->method(
'fetchAssoc')->willReturnOnConsecutiveCalls(
110 'pattern_certificate_id' => 1,
114 'user_name' =>
'Niels Theen',
115 'acquired_timestamp' => 123_456_789,
116 'certificate_content' =>
'<xml>Some Content</xml>',
117 'template_values' =>
'[]',
118 'valid_until' =>
null,
120 'ilias_version' =>
'v5.4.0',
121 'currently_active' =>
true,
122 'background_image_path' =>
'/some/where/background.jpg',
123 'tile_image_path' =>
'/some/where/tile_image.svg',
124 'background_image_ident' =>
'-',
125 'tile_image_ident' =>
'-',
126 'title' =>
'Some Title',
127 'certificate_id' =>
'11111111-2222-3333-4444-555555555555' 131 'pattern_certificate_id' => 5,
135 'user_name' =>
'Niels Theen',
136 'acquired_timestamp' => 987_654_321,
137 'certificate_content' =>
'<xml>Some Other Content</xml>',
138 'template_values' =>
'[]',
139 'valid_until' =>
null,
141 'ilias_version' =>
'v5.3.0',
142 'currently_active' =>
true,
143 'background_image_path' =>
'/some/where/else/background.jpg',
144 'tile_image_path' =>
'/some/where/tile_image.svg',
145 'background_image_ident' =>
'-',
146 'tile_image_ident' =>
'-',
147 'title' =>
'Someother Title',
148 'certificate_id' =>
'11111111-2222-3333-4444-555555555555' 153 $logger = $this->getMockBuilder(ilLogger::class)
154 ->disableOriginalConstructor()
157 $logger->expects($this->atLeastOnce())
166 $results = $repository->fetchActiveCertificates(400);
168 $this->assertSame(141,
$results[0]->getUserCertificate()->
getId());
169 $this->assertSame(142,
$results[1]->getUserCertificate()->
getId());
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
◆ testFetchCertificate()
ilUserCertificateRepositoryTest::testFetchCertificate |
( |
| ) |
|
Definition at line 335 of file ilUserCertificateRepositoryTest.php.
References null.
337 $database = $this->createMock(ilDBInterface::class);
339 $database->method(
'nextId')
342 $database->method(
'fetchAssoc')->willReturn(
345 'pattern_certificate_id' => 1,
349 'user_name' =>
'Niels Theen',
350 'acquired_timestamp' => 123_456_789,
351 'certificate_content' =>
'<xml>Some Content</xml>',
352 'template_values' =>
'[]',
353 'valid_until' =>
null,
355 'ilias_version' =>
'v5.4.0',
356 'currently_active' =>
true,
357 'background_image_path' =>
'/some/where/background.jpg',
358 'tile_image_path' =>
'/some/where/else/tile_image.svg',
359 'background_image_ident' =>
'-',
360 'tile_image_ident' =>
'-',
361 'title' =>
'SomeTitle',
362 'someDescription' =>
'SomeDescription',
363 'certificate_id' =>
'11111111-2222-3333-4444-555555555555' 367 $logger = $this->getMockBuilder(ilLogger::class)
368 ->disableOriginalConstructor()
371 $logger->expects($this->atLeastOnce())
376 $result = $repository->fetchCertificate(141);
378 $this->assertSame(141, $result->getId());
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
◆ testFetchNoActiveCertificateLeadsToException()
ilUserCertificateRepositoryTest::testFetchNoActiveCertificateLeadsToException |
( |
| ) |
|
Definition at line 240 of file ilUserCertificateRepositoryTest.php.
242 $this->expectException(ilException::class);
244 $database = $this->createMock(ilDBInterface::class);
246 $database->method(
'nextId')
249 $database->method(
'fetchAssoc')->willReturn([]);
251 $logger = $this->getMockBuilder(ilLogger::class)
252 ->disableOriginalConstructor()
255 $logger->expects($this->atLeastOnce())
260 $repository->fetchActiveCertificate(400, 20);
262 $this->fail(
'Should never happen. Certificate Found?');
◆ testFetchObjectWithCertificateForUser()
ilUserCertificateRepositoryTest::testFetchObjectWithCertificateForUser |
( |
| ) |
|
Definition at line 407 of file ilUserCertificateRepositoryTest.php.
References $results.
409 $database = $this->createMock(ilDBInterface::class);
412 ->expects($this->once())
416 ->expects($this->once())
420 ->expects($this->exactly(3))
421 ->method(
'fetchAssoc')
422 ->willReturnOnConsecutiveCalls(
428 $database->method(
'fetchAssoc')
431 $logger = $this->getMockBuilder(ilLogger::class)
432 ->disableOriginalConstructor()
435 $logger->expects($this->atLeastOnce())
441 $objectIds = [200, 300, 400];
443 $results = $repository->fetchObjectIdsWithCertificateForUser($userId, $objectIds);
445 $this->assertSame([100, 300],
$results);
◆ testFetchUserIdsWithCertificateForObject()
ilUserCertificateRepositoryTest::testFetchUserIdsWithCertificateForObject |
( |
| ) |
|
Definition at line 448 of file ilUserCertificateRepositoryTest.php.
References $results.
450 $database = $this->createMock(ilDBInterface::class);
453 ->expects($this->once())
457 ->expects($this->exactly(3))
458 ->method(
'fetchAssoc')
459 ->willReturnOnConsecutiveCalls(
465 $database->method(
'fetchAssoc')
468 $logger = $this->getMockBuilder(ilLogger::class)
469 ->disableOriginalConstructor()
472 $logger->expects($this->atLeastOnce())
479 $results = $repository->fetchUserIdsWithCertificateForObject($objectId);
481 $this->assertSame([100, 300],
$results);
◆ testNoCertificateInFetchtCertificateLeadsToException()
ilUserCertificateRepositoryTest::testNoCertificateInFetchtCertificateLeadsToException |
( |
| ) |
|
Definition at line 381 of file ilUserCertificateRepositoryTest.php.
383 $this->expectException(ilException::class);
385 $database = $this->createMock(ilDBInterface::class);
387 $database->method(
'nextId')
390 $database->method(
'fetchAssoc')
393 $logger = $this->getMockBuilder(ilLogger::class)
394 ->disableOriginalConstructor()
397 $logger->expects($this->atLeastOnce())
402 $repository->fetchCertificate(141);
404 $this->fail(
'Should never happen. Certificate Found?');
◆ testSaveOfUserCertificateToDatabase()
ilUserCertificateRepositoryTest::testSaveOfUserCertificateToDatabase |
( |
| ) |
|
Definition at line 25 of file ilUserCertificateRepositoryTest.php.
References null.
27 $database = $this->createMock(ilDBInterface::class);
29 $database->method(
'nextId')
32 $database->method(
'insert')->with(
35 'id' => [
'integer', 141],
36 'pattern_certificate_id' => [
'integer', 1],
37 'obj_id' => [
'integer', 20],
38 'obj_type' => [
'text',
'crs'],
39 'usr_id' => [
'integer', 400],
40 'user_name' => [
'text',
'Niels Theen'],
41 'acquired_timestamp' => [
'integer', 123_456_789],
42 'certificate_content' => [
'clob',
'<xml>Some Content</xml>'],
43 'template_values' => [
'clob',
'[]'],
44 'valid_until' => [
'integer',
null],
45 'version' => [
'integer', 1],
46 'ilias_version' => [
'text',
'v5.4.0'],
47 'currently_active' => [
'integer',
true],
48 'background_image_path' => [
'text',
'/some/where/background.jpg'],
49 'tile_image_path' => [
'text',
'/some/where/tile_image.svg'],
50 'background_image_ident' => [
'text',
'-'],
51 'tile_image_ident' => [
'text',
'-'],
52 'certificate_id' => [
'text',
'11111111-2222-3333-4444-555555555555'],
56 $database->method(
'tableColumnExists')->willReturnMap(
58 [
'il_cert_user_cert',
'background_image_path',
true],
59 [
'il_cert_user_cert',
'tile_image_path',
true],
63 $logger = $this->getMockBuilder(ilLogger::class)
64 ->disableOriginalConstructor()
67 $logger->expects($this->atLeastOnce())
83 '<xml>Some Content</xml>',
90 '/some/where/background.jpg',
91 '/some/where/tile_image.svg',
97 $repository->save($userCertificate);
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
The documentation for this class was generated from the following file: