ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

References ILIAS\LTI\ToolProvider\$settings.

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  ->addMethods(['refreshSettings'])
50  ->getMock();
51  $rpc_client->expects($this->once())
52  ->method('refreshSettings')
53  ->with('id_test');
54 
55  $coord = $this->getMockBuilder(ilObjSearchRpcClientCoordinator::class)
56  ->setConstructorArgs([$settings, $src_logger])
57  ->onlyMethods(['getRpcClient', 'getClientId'])
58  ->getMock();
59  $coord->expects($this->once())
60  ->method('getClientId')
61  ->willReturn('id');
62  $coord->expects($this->once())
63  ->method('getRpcClient')
64  ->willReturn($rpc_client);
65 
66  $this->assertSame(true, $coord->refreshLuceneSettings());
67  }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200

◆ testRefreshLuceneSettingsException()

ilObjSearchRpcClientCoordinatorTest::testRefreshLuceneSettingsException ( )

Definition at line 69 of file ilObjSearchRpcClientCoordinatorTest.php.

References ILIAS\LTI\ToolProvider\$settings.

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

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