19 declare(strict_types=1);
35 protected function setUp(): void
37 $this->database = $this->createMock(ilDBInterface::class);
38 $this->controller = $this->createMock(ilCtrlInterface::class);
39 $this->
logger = $this->getMockBuilder(ilLogger::class)
40 ->disableOriginalConstructor()
44 public function testGetUserData():
void 46 $filter = new \ILIAS\Certificate\API\Filter\UserDataFilter();
49 ->method(
'fetchAssoc')
50 ->willReturnOnConsecutiveCalls(
56 'acquired_timestamp' => 1234567890,
58 'firstname' =>
'ilyas',
59 'lastname' =>
'homer',
60 'login' =>
'breakdanceMcFunkyPants',
61 'email' =>
'ilyas@ilias.de',
62 'second_email' =>
'breakdance@funky.de' 69 'acquired_timestamp' => 1234567890,
71 'firstname' =>
'ilyas',
72 'lastname' =>
'homer',
73 'login' =>
'breakdanceMcFunkyPants',
74 'email' =>
'ilyas@ilias.de',
75 'second_email' =>
'breakdance@funky.de' 79 $this->controller->method(
'getLinkTargetByClass')->willReturn(
'somewhere.php?goto=4');
81 $repository = new \ILIAS\Certificate\API\Repository\UserDataRepository(
89 $userData = $repository->getUserData($filter, [
'something']);
92 $object = $userData[5];
93 $this->assertSame(
'test', $object->getObjectTitle());
94 $this->assertSame(5, $object->getCertificateId());
95 $this->assertSame(100, $object->getObjectId());
96 $this->assertSame([5000, 6000], $object->getObjectRefIds());
97 $this->assertSame(1234567890, $object->getIssuedOnTimestamp());
98 $this->assertSame(2000, $object->getUserId());
99 $this->assertSame(
'ilyas', $object->getUserFirstName());
100 $this->assertSame(
'homer', $object->getUserLastName());
101 $this->assertSame(
'breakdanceMcFunkyPants', $object->getUserLogin());
102 $this->assertSame(
'ilyas@ilias.de', $object->getUserEmail());
103 $this->assertSame(
'breakdance@funky.de', $object->getUserSecondEmail());
104 $this->assertSame(
'somewhere.php?goto=4', $object->getDownloadLink());
Class ilCertificateBaseTestCase.