ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilObjSearchRpcClientCoordinatorTest Class Reference

Unit tests for class ilObjSearchRpcClientCoordinator. More...

+ Inheritance diagram for ilObjSearchRpcClientCoordinatorTest:
+ Collaboration diagram for ilObjSearchRpcClientCoordinatorTest:

Public Member Functions

 testRefreshLuceneSettings ()
 
 testRefreshLuceneSettingsException ()
 

Detailed Description

Member Function Documentation

◆ testRefreshLuceneSettings()

ilObjSearchRpcClientCoordinatorTest::testRefreshLuceneSettings ( )

Definition at line 29 of file ilObjSearchRpcClientCoordinatorTest.php.

29 : void
30 {
31 $src_logger = $this->getMockBuilder(ilLogger::class)
32 ->disableOriginalConstructor()
33 ->onlyMethods(['error'])
34 ->getMock();
35 $src_logger->expects($this->never())
36 ->method('error');
37
38 $settings = $this->getMockBuilder(ilSetting::class)
39 ->disableOriginalConstructor()
40 ->onlyMethods(['get'])
41 ->getMock();
42 $settings->expects($this->once())
43 ->method('get')
44 ->with('inst_id', '0')
45 ->willReturn('test');
46
47 $rpc_client = $this->getMockBuilder(ilRpcClient::class)
48 ->disableOriginalConstructor()
49 ->getMock();
50 $rpc_client->expects($this->once())
51 ->method('__call')
52 ->with('refreshSettings', ['id_test']);
53
54 $coord = $this->getMockBuilder(ilObjSearchRpcClientCoordinator::class)
55 ->setConstructorArgs([$settings, $src_logger])
56 ->onlyMethods(['getRpcClient', 'getClientId'])
57 ->getMock();
58 $coord->expects($this->once())
59 ->method('getClientId')
60 ->willReturn('id');
61 $coord->expects($this->once())
62 ->method('getRpcClient')
63 ->willReturn($rpc_client);
64
65 $this->assertSame(true, $coord->refreshLuceneSettings());
66 }

◆ testRefreshLuceneSettingsException()

ilObjSearchRpcClientCoordinatorTest::testRefreshLuceneSettingsException ( )

Definition at line 68 of file ilObjSearchRpcClientCoordinatorTest.php.

68 : void
69 {
70 $src_logger = $this->getMockBuilder(ilLogger::class)
71 ->disableOriginalConstructor()
72 ->onlyMethods(['error'])
73 ->getMock();
74 $src_logger->expects($this->once())
75 ->method('error')
76 ->with(
77 'Refresh of lucene server settings ' .
78 'failed with message: message'
79 );
80
81 $settings = $this->getMockBuilder(ilSetting::class)
82 ->disableOriginalConstructor()
83 ->onlyMethods(['get'])
84 ->getMock();
85 $settings->expects($this->once())
86 ->method('get')
87 ->with('inst_id', '0')
88 ->willReturn('test');
89
90 $rpc_client = $this->getMockBuilder(ilRpcClient::class)
91 ->disableOriginalConstructor()
92 ->getMock();
93 $rpc_client->expects($this->once())
94 ->method('__call')
95 ->with('refreshSettings', ['id_test'])
96 ->willThrowException(new Exception('message'));
97
98 $coord = $this->getMockBuilder(ilObjSearchRpcClientCoordinator::class)
99 ->setConstructorArgs([$settings, $src_logger])
100 ->onlyMethods(['getRpcClient', 'getClientId'])
101 ->getMock();
102 $coord->expects($this->once())
103 ->method('getClientId')
104 ->willReturn('id');
105 $coord->expects($this->once())
106 ->method('getRpcClient')
107 ->willReturn($rpc_client);
108
109 $this->expectException(Exception::class);
110 $coord->refreshLuceneSettings();
111 }

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