ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
UserCertificateAPITest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 {
25  public function testUserDataCall(): void
26  {
27  $repository = $this->getMockBuilder(UserDataRepository::class)
28  ->disableOriginalConstructor()
29  ->getMock();
30  $logger = new \ILIAS\components\Logging\NullLogger();
31  $database = $this->createMock(ilDBInterface::class);
32 
33  $userData = new \ILIAS\Certificate\API\Data\UserCertificateDto(
34  5,
35  'Some Title',
36  100,
37  1_234_567_890,
38  20,
39  'Ilyas',
40  'Homer',
41  'breakdanceMcFunkyPants',
42  'iliyas@ilias.de',
43  'breakdance@funky.de',
44  [3000]
45  );
46 
47  $repository->method('getUserData')
48  ->willReturn([5 => $userData]);
49 
50  $api = new \ILIAS\Certificate\API\UserCertificateAPI(
51  $repository,
52  $this->createMock(ilCertificateTemplateRepository::class),
54  $database,
55  $logger
56  ),
58  $logger,
59  $this->getMockBuilder(ilObjectDataCache::class)->disableOriginalConstructor()->getMock()
60  );
61 
62  $result = $api->getUserCertificateData(new \ILIAS\Certificate\API\Filter\UserDataFilter(), []);
63 
64  $this->assertSame(['5' => $userData], $result);
65  }
66 }
Interface Observer Contains several chained tasks and infos about them.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...