|
19 | 19 | use Elastic\Elasticsearch\Exception\AuthenticationException;
|
20 | 20 | use Elastic\Elasticsearch\Exception\ConfigException;
|
21 | 21 | use Elastic\Elasticsearch\Exception\InvalidArgumentException;
|
| 22 | +use Elastic\Transport\Exception\CloudIdParseException; |
22 | 23 | use Elastic\Transport\NodePool\NodePoolInterface;
|
23 | 24 | use Http\Client\HttpAsyncClient;
|
24 | 25 | use Nyholm\Psr7\Factory\Psr17Factory;
|
@@ -52,7 +53,7 @@ public function testCreate()
|
52 | 53 | $this->assertInstanceOf(ClientBuilder::class, $this->builder);
|
53 | 54 | }
|
54 | 55 |
|
55 |
| - public function getConfig() |
| 56 | + public static function getConfig() |
56 | 57 | {
|
57 | 58 | return [
|
58 | 59 | [[
|
@@ -227,36 +228,11 @@ public function testSetElasticCloudId()
|
227 | 228 | $this->assertEquals($this->builder, $result);
|
228 | 229 | }
|
229 | 230 |
|
230 |
| - public function getCloudIdExamples() |
| 231 | + public function testSetElasticCloudIdThrowsException() |
231 | 232 | {
|
232 |
| - return [ |
233 |
| - ['cluster:d2VzdGV1cm9wZS5henVyZS5lbGFzdGljLWNsb3VkLmNvbTo5MjQzJGM2NjM3ZjMxMmM1MjQzY2RhN2RlZDZlOTllM2QyYzE5JA==', 'c6637f312c5243cda7ded6e99e3d2c19.westeurope.azure.elastic-cloud.com', 9243], |
234 |
| - ['cluster:d2VzdGV1cm9wZS5henVyZS5lbGFzdGljLWNsb3VkLmNvbSRlN2RlOWYxMzQ1ZTQ0OTAyODNkOTAzYmU1YjZmOTE5ZSQ=', 'e7de9f1345e4490283d903be5b6f919e.westeurope.azure.elastic-cloud.com', null], |
235 |
| - ['cluster:d2VzdGV1cm9wZS5henVyZS5lbGFzdGljLWNsb3VkLmNvbSQ4YWY3ZWUzNTQyMGY0NThlOTAzMDI2YjQwNjQwODFmMiQyMDA2MTU1NmM1NDA0OTg2YmZmOTU3ZDg0YTZlYjUxZg==', '8af7ee35420f458e903026b4064081f2.westeurope.azure.elastic-cloud.com', null] |
236 |
| - ]; |
237 |
| - } |
238 |
| - |
239 |
| - /** |
240 |
| - * @dataProvider getCloudIdExamples |
241 |
| - */ |
242 |
| - public function testSetCloudIdWithExamples(string $cloudId, string $url, ?int $port) |
243 |
| - { |
244 |
| - $this->builder->setElasticCloudId($cloudId); |
245 |
| - |
246 |
| - $response = $this->psr17Factory->createResponse(200); |
247 |
| - $this->httpClient->method('sendRequest') |
248 |
| - ->willReturn($response); |
249 |
| - $this->builder->setHttpClient($this->httpClient); |
250 |
| - |
251 |
| - $client = $this->builder->build(); |
252 |
| - $this->assertInstanceOf(Client::class, $client); |
253 |
| - |
254 |
| - $transport = $client->getTransport(); |
255 |
| - $request = $this->psr17Factory->createRequest('GET', ''); |
256 |
| - $transport->sendRequest($request); |
257 |
| - |
258 |
| - $this->assertEquals($url, $transport->getLastRequest()->getUri()->getHost()); |
259 |
| - $this->assertEquals($port, $transport->getLastRequest()->getUri()->getPort()); |
| 233 | + $this->builder->setElasticCloudId('xxx'); |
| 234 | + $this->expectException(CloudIdParseException::class); |
| 235 | + $client = $this->builder->build(); |
260 | 236 | }
|
261 | 237 |
|
262 | 238 | public function testSetRetries()
|
|
0 commit comments