Unit tests for class ilObjSearchRpcClientCoordinator.
More...
◆ testRefreshLuceneSettings()
ilObjSearchRpcClientCoordinatorTest::testRefreshLuceneSettings |
( |
| ) |
|
Definition at line 29 of file ilObjSearchRpcClientCoordinatorTest.php.
31 $src_logger = $this->getMockBuilder(ilLogger::class)
32 ->disableOriginalConstructor()
33 ->onlyMethods([
'error'])
35 $src_logger->expects($this->never())
38 $settings = $this->getMockBuilder(ilSetting::class)
39 ->disableOriginalConstructor()
40 ->onlyMethods([
'get'])
42 $settings->expects($this->once())
44 ->with(
'inst_id',
'0')
47 $rpc_client = $this->getMockBuilder(ilRpcClient::class)
48 ->disableOriginalConstructor()
50 $rpc_client->expects($this->once())
52 ->with(
'refreshSettings', [
'id_test']);
54 $coord = $this->getMockBuilder(ilObjSearchRpcClientCoordinator::class)
55 ->setConstructorArgs([$settings, $src_logger])
56 ->onlyMethods([
'getRpcClient',
'getClientId'])
58 $coord->expects($this->once())
59 ->method(
'getClientId')
61 $coord->expects($this->once())
62 ->method(
'getRpcClient')
63 ->willReturn($rpc_client);
65 $this->assertSame(
true, $coord->refreshLuceneSettings());
◆ testRefreshLuceneSettingsException()
ilObjSearchRpcClientCoordinatorTest::testRefreshLuceneSettingsException |
( |
| ) |
|
Definition at line 68 of file ilObjSearchRpcClientCoordinatorTest.php.
70 $src_logger = $this->getMockBuilder(ilLogger::class)
71 ->disableOriginalConstructor()
72 ->onlyMethods([
'error'])
74 $src_logger->expects($this->once())
77 'Refresh of lucene server settings ' .
78 'failed with message: message' 81 $settings = $this->getMockBuilder(ilSetting::class)
82 ->disableOriginalConstructor()
83 ->onlyMethods([
'get'])
85 $settings->expects($this->once())
87 ->with(
'inst_id',
'0')
90 $rpc_client = $this->getMockBuilder(ilRpcClient::class)
91 ->disableOriginalConstructor()
93 $rpc_client->expects($this->once())
95 ->with(
'refreshSettings', [
'id_test'])
96 ->willThrowException(
new Exception(
'message'));
98 $coord = $this->getMockBuilder(ilObjSearchRpcClientCoordinator::class)
99 ->setConstructorArgs([$settings, $src_logger])
100 ->onlyMethods([
'getRpcClient',
'getClientId'])
102 $coord->expects($this->once())
103 ->method(
'getClientId')
105 $coord->expects($this->once())
106 ->method(
'getRpcClient')
107 ->willReturn($rpc_client);
109 $this->expectException(Exception::class);
110 $coord->refreshLuceneSettings();
The documentation for this class was generated from the following file: