ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCertificateUserForObjectPreloaderTest Class Reference
+ Inheritance diagram for ilCertificateUserForObjectPreloaderTest:
+ Collaboration diagram for ilCertificateUserForObjectPreloaderTest:

Public Member Functions

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

Detailed Description

Member Function Documentation

◆ testUserIsNoProloaded()

ilCertificateUserForObjectPreloaderTest::testUserIsNoProloaded ( )

Definition at line 59 of file ilCertificateUserForObjectPreloaderTest.php.

References $result.

60  {
61  $userCertificateRepository = $this->getMockBuilder('ilUserCertificateRepository')
62  ->disableOriginalConstructor()
63  ->getMock();
64 
65  $userCertificateRepository->method('fetchUserIdsWithCertificateForObject')
66  ->willReturn(array(1, 2, 3));
67 
68  $activeValidator = $this->getMockBuilder('ilCertificateActiveValidator')
69  ->disableOriginalConstructor()
70  ->getMock();
71 
72  $activeValidator->method('validate')
73  ->willReturn(true);
74 
75  $preloader = new ilCertificateUserForObjectPreloader($userCertificateRepository, $activeValidator);
76 
77  $preloader->preLoadDownloadableCertificates(100);
78 
79  $result = $preloader->isPreloaded(200, 1);
80 
81  $this->assertFalse($result);
82  }
$result

◆ testUsersWithCertifcatesWillBePreoloaded()

ilCertificateUserForObjectPreloaderTest::testUsersWithCertifcatesWillBePreoloaded ( )

Definition at line 9 of file ilCertificateUserForObjectPreloaderTest.php.

References $result.

10  {
11  $userCertificateRepository = $this->getMockBuilder('ilUserCertificateRepository')
12  ->disableOriginalConstructor()
13  ->getMock();
14 
15  $userCertificateRepository->method('fetchUserIdsWithCertificateForObject')
16  ->willReturn(array(1, 2, 3));
17 
18  $activeValidator = $this->getMockBuilder('ilCertificateActiveValidator')
19  ->disableOriginalConstructor()
20  ->getMock();
21 
22  $activeValidator->method('validate')
23  ->willReturn(true);
24 
25  $preloader = new ilCertificateUserForObjectPreloader($userCertificateRepository, $activeValidator);
26 
27  $preloader->preLoadDownloadableCertificates(100);
28 
29  $result = $preloader->isPreloaded(100, 1);
30 
31  $this->assertTrue($result);
32  }
$result

◆ testUserWithCertificateIsNotPreloaded()

ilCertificateUserForObjectPreloaderTest::testUserWithCertificateIsNotPreloaded ( )

Definition at line 34 of file ilCertificateUserForObjectPreloaderTest.php.

References $result.

35  {
36  $userCertificateRepository = $this->getMockBuilder('ilUserCertificateRepository')
37  ->disableOriginalConstructor()
38  ->getMock();
39 
40  $userCertificateRepository->method('fetchUserIdsWithCertificateForObject')
41  ->willReturn(array(1, 2, 3));
42 
43  $activeValidator = $this->getMockBuilder('ilCertificateActiveValidator')
44  ->disableOriginalConstructor()
45  ->getMock();
46 
47  $activeValidator->method('validate')
48  ->willReturn(true);
49 
50  $preloader = new ilCertificateUserForObjectPreloader($userCertificateRepository, $activeValidator);
51 
52  $preloader->preLoadDownloadableCertificates(100);
53 
54  $result = $preloader->isPreloaded(100, 5);
55 
56  $this->assertFalse($result);
57  }
$result

◆ testWontPreloadBecauseCertificatesAreCurrentlyInActive()

ilCertificateUserForObjectPreloaderTest::testWontPreloadBecauseCertificatesAreCurrentlyInActive ( )

Definition at line 84 of file ilCertificateUserForObjectPreloaderTest.php.

References $result.

85  {
86  $userCertificateRepository = $this->getMockBuilder('ilUserCertificateRepository')
87  ->disableOriginalConstructor()
88  ->getMock();
89 
90  $userCertificateRepository
91  ->expects($this->never())
92  ->method('fetchUserIdsWithCertificateForObject');
93 
94  $activeValidator = $this->getMockBuilder('ilCertificateActiveValidator')
95  ->disableOriginalConstructor()
96  ->getMock();
97 
98  $activeValidator->method('validate')
99  ->willReturn(false);
100 
101  $preloader = new ilCertificateUserForObjectPreloader($userCertificateRepository, $activeValidator);
102 
103  $preloader->preLoadDownloadableCertificates(100);
104 
105  $result = $preloader->isPreloaded(100, 5);
106 
107  $this->assertFalse($result);
108  }
$result

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