19 declare(strict_types=1);
28 $userCertificateRepository = $this->getMockBuilder(ilUserCertificateRepository::class)
29 ->disableOriginalConstructor()
32 $userCertificateRepository->method(
'fetchUserIdsWithCertificateForObject')
33 ->willReturn([1, 2, 3]);
35 $activeValidator = $this->getMockBuilder(ilCertificateActiveValidator::class)
36 ->disableOriginalConstructor()
39 $activeValidator->method(
'validate')
44 $preloader->preLoadDownloadableCertificates(100);
46 $result = $preloader->isPreloaded(100, 1);
48 $this->assertTrue($result);
53 $userCertificateRepository = $this->getMockBuilder(ilUserCertificateRepository::class)
54 ->disableOriginalConstructor()
57 $userCertificateRepository->method(
'fetchUserIdsWithCertificateForObject')
58 ->willReturn([1, 2, 3]);
60 $activeValidator = $this->getMockBuilder(ilCertificateActiveValidator::class)
61 ->disableOriginalConstructor()
64 $activeValidator->method(
'validate')
69 $preloader->preLoadDownloadableCertificates(100);
71 $result = $preloader->isPreloaded(100, 5);
73 $this->assertFalse($result);
78 $userCertificateRepository = $this->getMockBuilder(ilUserCertificateRepository::class)
79 ->disableOriginalConstructor()
82 $userCertificateRepository->method(
'fetchUserIdsWithCertificateForObject')
83 ->willReturn([1, 2, 3]);
85 $activeValidator = $this->getMockBuilder(ilCertificateActiveValidator::class)
86 ->disableOriginalConstructor()
89 $activeValidator->method(
'validate')
94 $preloader->preLoadDownloadableCertificates(100);
96 $result = $preloader->isPreloaded(200, 1);
98 $this->assertFalse($result);
103 $userCertificateRepository = $this->getMockBuilder(ilUserCertificateRepository::class)
104 ->disableOriginalConstructor()
107 $userCertificateRepository
108 ->expects($this->never())
109 ->method(
'fetchUserIdsWithCertificateForObject');
111 $activeValidator = $this->getMockBuilder(ilCertificateActiveValidator::class)
112 ->disableOriginalConstructor()
115 $activeValidator->method(
'validate')
120 $preloader->preLoadDownloadableCertificates(100);
122 $result = $preloader->isPreloaded(100, 5);
124 $this->assertFalse($result);
Class ilCertificateBaseTestCase.
testUserWithCertificateIsNotPreloaded()
testUsersWithCertifcatesWillBePreoloaded()
testWontPreloadBecauseCertificatesAreCurrentlyInActive()