|
100 | 100 | 'capabilities' => [], |
101 | 101 | ] |
102 | 102 | ); |
103 | | - $this->session->shouldReceive('set')->with('client_info', Mockery::on(fn($value) => $value->name === 'client' && $value->version === '1.0'))->once(); |
| 103 | + $this->session->shouldReceive('set')->with('client_info', Mockery::on(fn($value) => $value['name'] === 'client' && $value['version'] === '1.0'))->once(); |
| 104 | + $this->session->shouldReceive('set')->with('protocol_version', Protocol::LATEST_PROTOCOL_VERSION)->once(); |
104 | 105 |
|
105 | 106 | $result = $this->dispatcher->handleRequest($request, $this->session); |
106 | 107 | expect($result)->toBeInstanceOf(InitializeResult::class); |
|
135 | 136 | it('can handle initialize request', function () { |
136 | 137 | $clientInfo = Implementation::make('TestClient', '0.9.9'); |
137 | 138 | $request = InitializeRequest::make(1, Protocol::LATEST_PROTOCOL_VERSION, ClientCapabilities::make(), $clientInfo, []); |
138 | | - $this->session->shouldReceive('set')->with('client_info', $clientInfo)->once(); |
| 139 | + $this->session->shouldReceive('set')->with('client_info', $clientInfo->toArray())->once(); |
| 140 | + $this->session->shouldReceive('set')->with('protocol_version', Protocol::LATEST_PROTOCOL_VERSION)->once(); |
139 | 141 |
|
140 | 142 | $result = $this->dispatcher->handleInitialize($request, $this->session); |
141 | 143 | expect($result->protocolVersion)->toBe(Protocol::LATEST_PROTOCOL_VERSION); |
|
147 | 149 | $clientInfo = Implementation::make('TestClient', '0.9.9'); |
148 | 150 | $clientRequestedVersion = '2024-11-05'; |
149 | 151 | $request = InitializeRequest::make(1, $clientRequestedVersion, ClientCapabilities::make(), $clientInfo, []); |
150 | | - $this->session->shouldReceive('set')->with('client_info', $clientInfo)->once(); |
| 152 | + $this->session->shouldReceive('set')->with('client_info', $clientInfo->toArray())->once(); |
| 153 | + $this->session->shouldReceive('set')->with('protocol_version', $clientRequestedVersion)->once(); |
151 | 154 |
|
152 | 155 | $result = $this->dispatcher->handleInitialize($request, $this->session); |
153 | 156 | expect($result->protocolVersion)->toBe($clientRequestedVersion); |
|
159 | 162 | $clientInfo = Implementation::make('TestClient', '0.9.9'); |
160 | 163 | $unsupportedVersion = '1999-01-01'; |
161 | 164 | $request = InitializeRequest::make(1, $unsupportedVersion, ClientCapabilities::make(), $clientInfo, []); |
162 | | - $this->session->shouldReceive('set')->with('client_info', $clientInfo)->once(); |
| 165 | + $this->session->shouldReceive('set')->with('client_info', $clientInfo->toArray())->once(); |
| 166 | + $this->session->shouldReceive('set')->with('protocol_version', Protocol::LATEST_PROTOCOL_VERSION)->once(); |
163 | 167 |
|
164 | 168 | $result = $this->dispatcher->handleInitialize($request, $this->session); |
165 | 169 | expect($result->protocolVersion)->toBe(Protocol::LATEST_PROTOCOL_VERSION); |
|
0 commit comments