ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCertificateUserForObjectPreloaderTest Class Reference
+ Inheritance diagram for ilCertificateUserForObjectPreloaderTest:
+ Collaboration diagram for ilCertificateUserForObjectPreloaderTest:

Public Member Functions

 testUsersWithCertifcatesWillBePreoloaded ()
 
 testUserWithCertificateIsNotPreloaded ()
 
 testUserIsNoProloaded ()
 
 testWontPreloadBecauseCertificatesAreCurrentlyInActive ()
 

Additional Inherited Members

- Protected Member Functions inherited from ilCertificateBaseTestCase
 setUp ()
 
 tearDown ()
 
 assertDoesNotThrow (callable $cb, string $message='')
 
 assertThrows (callable $cb, ?string $expected_class=null, ?string $expected_message=null)
 @template T of Throwable More...
 
 setGlobalVariable (string $name, mixed $value)
 
- Protected Attributes inherited from ilCertificateBaseTestCase
Container $dic
 

Detailed Description

Definition at line 21 of file ilCertificateUserForObjectPreloaderTest.php.

Member Function Documentation

◆ testUserIsNoProloaded()

ilCertificateUserForObjectPreloaderTest::testUserIsNoProloaded ( )

Definition at line 73 of file ilCertificateUserForObjectPreloaderTest.php.

73 : void
74 {
75 $userCertificateRepository = $this->getMockBuilder(ilUserCertificateRepository::class)
76 ->disableOriginalConstructor()
77 ->getMock();
78
79 $userCertificateRepository->method('fetchUserIdsWithCertificateForObject')
80 ->willReturn([1, 2, 3]);
81
82 $activeValidator = $this->getMockBuilder(ilCertificateActiveValidator::class)
83 ->disableOriginalConstructor()
84 ->getMock();
85
86 $activeValidator->method('validate')
87 ->willReturn(true);
88
89 $preloader = new ilCertificateUserForObjectPreloader($userCertificateRepository, $activeValidator);
90
91 $preloader->preLoadDownloadableCertificates(100);
92
93 $result = $preloader->isPreloaded(200, 1);
94
95 $this->assertFalse($result);
96 }

◆ testUsersWithCertifcatesWillBePreoloaded()

ilCertificateUserForObjectPreloaderTest::testUsersWithCertifcatesWillBePreoloaded ( )

Definition at line 23 of file ilCertificateUserForObjectPreloaderTest.php.

23 : void
24 {
25 $userCertificateRepository = $this->getMockBuilder(ilUserCertificateRepository::class)
26 ->disableOriginalConstructor()
27 ->getMock();
28
29 $userCertificateRepository->method('fetchUserIdsWithCertificateForObject')
30 ->willReturn([1, 2, 3]);
31
32 $activeValidator = $this->getMockBuilder(ilCertificateActiveValidator::class)
33 ->disableOriginalConstructor()
34 ->getMock();
35
36 $activeValidator->method('validate')
37 ->willReturn(true);
38
39 $preloader = new ilCertificateUserForObjectPreloader($userCertificateRepository, $activeValidator);
40
41 $preloader->preLoadDownloadableCertificates(100);
42
43 $result = $preloader->isPreloaded(100, 1);
44
45 $this->assertTrue($result);
46 }

◆ testUserWithCertificateIsNotPreloaded()

ilCertificateUserForObjectPreloaderTest::testUserWithCertificateIsNotPreloaded ( )

Definition at line 48 of file ilCertificateUserForObjectPreloaderTest.php.

48 : void
49 {
50 $userCertificateRepository = $this->getMockBuilder(ilUserCertificateRepository::class)
51 ->disableOriginalConstructor()
52 ->getMock();
53
54 $userCertificateRepository->method('fetchUserIdsWithCertificateForObject')
55 ->willReturn([1, 2, 3]);
56
57 $activeValidator = $this->getMockBuilder(ilCertificateActiveValidator::class)
58 ->disableOriginalConstructor()
59 ->getMock();
60
61 $activeValidator->method('validate')
62 ->willReturn(true);
63
64 $preloader = new ilCertificateUserForObjectPreloader($userCertificateRepository, $activeValidator);
65
66 $preloader->preLoadDownloadableCertificates(100);
67
68 $result = $preloader->isPreloaded(100, 5);
69
70 $this->assertFalse($result);
71 }

◆ testWontPreloadBecauseCertificatesAreCurrentlyInActive()

ilCertificateUserForObjectPreloaderTest::testWontPreloadBecauseCertificatesAreCurrentlyInActive ( )

Definition at line 98 of file ilCertificateUserForObjectPreloaderTest.php.

98 : void
99 {
100 $userCertificateRepository = $this->getMockBuilder(ilUserCertificateRepository::class)
101 ->disableOriginalConstructor()
102 ->getMock();
103
104 $userCertificateRepository
105 ->expects($this->never())
106 ->method('fetchUserIdsWithCertificateForObject');
107
108 $activeValidator = $this->getMockBuilder(ilCertificateActiveValidator::class)
109 ->disableOriginalConstructor()
110 ->getMock();
111
112 $activeValidator->method('validate')
113 ->willReturn(false);
114
115 $preloader = new ilCertificateUserForObjectPreloader($userCertificateRepository, $activeValidator);
116
117 $preloader->preLoadDownloadableCertificates(100);
118
119 $result = $preloader->isPreloaded(100, 5);
120
121 $this->assertFalse($result);
122 }

The documentation for this class was generated from the following file: