19 declare(strict_types=1);
26 private \ilDBInterface&\PHPUnit\Framework\MockObject\MockObject
$database;
27 private \ilCtrlInterface&\PHPUnit\Framework\MockObject\MockObject
$controller;
29 protected function setUp(): void
31 $this->database = $this->createMock(ilDBInterface::class);
32 $this->controller = $this->createMock(ilCtrlInterface::class);
35 public function testGetUserData():
void 37 $filter = new \ILIAS\Certificate\API\Filter\UserDataFilter();
40 ->method(
'fetchAssoc')
41 ->willReturnOnConsecutiveCalls(
47 'acquired_timestamp' => 1_234_567_890,
49 'firstname' =>
'ilyas',
50 'lastname' =>
'homer',
51 'login' =>
'breakdanceMcFunkyPants',
52 'email' =>
'ilyas@ilias.de',
53 'second_email' =>
'breakdance@funky.de' 60 'acquired_timestamp' => 1_234_567_890,
62 'firstname' =>
'ilyas',
63 'lastname' =>
'homer',
64 'login' =>
'breakdanceMcFunkyPants',
65 'email' =>
'ilyas@ilias.de',
66 'second_email' =>
'breakdance@funky.de' 71 $this->controller->method(
'getLinkTargetByClass')->willReturn(
'somewhere.php?goto=4');
73 $repository = new \ILIAS\Certificate\API\Repository\UserDataRepository(
80 $userData = $repository->getUserData($filter, [
'something']);
83 $object = $userData[5];
84 $this->assertSame(
'test', $object->getObjectTitle());
85 $this->assertSame(5, $object->getCertificateId());
86 $this->assertSame(100, $object->getObjectId());
87 $this->assertSame([5000, 6000], $object->getObjectRefIds());
88 $this->assertSame(1_234_567_890, $object->getIssuedOnTimestamp());
89 $this->assertSame(2000, $object->getUserId());
90 $this->assertSame(
'ilyas', $object->getUserFirstName());
91 $this->assertSame(
'homer', $object->getUserLastName());
92 $this->assertSame(
'breakdanceMcFunkyPants', $object->getUserLogin());
93 $this->assertSame(
'ilyas@ilias.de', $object->getUserEmail());
94 $this->assertSame(
'breakdance@funky.de', $object->getUserSecondEmail());
95 $this->assertSame(
'somewhere.php?goto=4', $object->getDownloadLink());
ilDBInterface &PHPUnit Framework MockObject MockObject $database
ilCtrlInterface &PHPUnit Framework MockObject MockObject $controller
Class ilCertificateBaseTestCase.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null