ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCertificateObjectsForUserPreloaderTest.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
8 {
10  {
11  $userCertificateRepository = $this->getMockBuilder('ilUserCertificateRepository')
12  ->disableOriginalConstructor()
13  ->getMock();
14 
15  $userCertificateRepository->method('fetchObjectIdsWithCertificateForUser')
16  ->willReturn(array(1, 2, 3));
17 
18  $preloader = new ilCertificateObjectsForUserPreloader($userCertificateRepository);
19 
20  $preloader->preLoad(100, array(500, 200));
21 
22  $result = $preloader->isPreloaded(100, 1);
23 
24  $this->assertTrue($result);
25  }
26 
28  {
29  $userCertificateRepository = $this->getMockBuilder('ilUserCertificateRepository')
30  ->disableOriginalConstructor()
31  ->getMock();
32 
33  $userCertificateRepository->method('fetchObjectIdsWithCertificateForUser')
34  ->willReturn(array(1, 2, 3));
35 
36  $preloader = new ilCertificateObjectsForUserPreloader($userCertificateRepository);
37 
38  $preloader->preLoad(100, array(500, 200));
39 
40  $result = $preloader->isPreloaded(100, 5);
41 
42  $this->assertFalse($result);
43  }
44 
45  public function testUserIsNoProloaded()
46  {
47  $userCertificateRepository = $this->getMockBuilder('ilUserCertificateRepository')
48  ->disableOriginalConstructor()
49  ->getMock();
50 
51  $userCertificateRepository->method('fetchObjectIdsWithCertificateForUser')
52  ->willReturn(array(1, 2, 3));
53 
54  $preloader = new ilCertificateObjectsForUserPreloader($userCertificateRepository);
55 
56  $preloader->preLoad(100, array(500, 200));
57 
58  $result = $preloader->isPreloaded(200, 1);
59 
60  $this->assertFalse($result);
61  }
62 }
$result