ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCertificateActiveValidatorTest.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
7 class ilCertificateActiveValidatorTest extends \PHPUnit\Framework\TestCase
8 {
10  {
11  $settings = $this->getMockBuilder('ilSetting')
12  ->disableOriginalConstructor()
13  ->getMock();
14 
15  $settings->method('get')
16  ->with('active')
17  ->willReturn(true);
18 
19  $rpcSettings = $this->getMockBuilder('ilRPCServerSettings')
20  ->disableOriginalConstructor()
21  ->getMock();
22 
23  $rpcSettings->method('isEnabled')
24  ->willReturn(true);
25 
26  $validator = new ilCertificateActiveValidator($settings, $rpcSettings);
27 
28  $result = $validator->validate();
29 
30  $this->assertTrue($result);
31  }
32 
34  {
35  $settings = $this->getMockBuilder('ilSetting')
36  ->disableOriginalConstructor()
37  ->getMock();
38 
39  $settings->method('get')
40  ->with('active')
41  ->willReturn(false);
42 
43  $rpcSettings = $this->getMockBuilder('ilRPCServerSettings')
44  ->disableOriginalConstructor()
45  ->getMock();
46 
47  $rpcSettings
48  ->expects($this->never())
49  ->method('isEnabled')
50  ->willReturn(true);
51 
52  $validator = new ilCertificateActiveValidator($settings, $rpcSettings);
53 
54  $result = $validator->validate();
55 
56  $this->assertFalse($result);
57  }
58 
60  {
61  $settings = $this->getMockBuilder('ilSetting')
62  ->disableOriginalConstructor()
63  ->getMock();
64 
65  $settings->method('get')
66  ->with('active')
67  ->willReturn(true);
68 
69  $rpcSettings = $this->getMockBuilder('ilRPCServerSettings')
70  ->disableOriginalConstructor()
71  ->getMock();
72 
73  $rpcSettings
74  ->expects($this->once())
75  ->method('isEnabled')
76  ->willReturn(false);
77 
78  $validator = new ilCertificateActiveValidator($settings, $rpcSettings);
79 
80  $result = $validator->validate();
81 
82  $this->assertFalse($result);
83  }
84 }
$result
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.