Skip to content

Commit d15f9cd

Browse files
authored
Update hosts tests to check the port
Now that the port is being stored separately from the host, we should be asserting that the port is stored correctly.
1 parent 7592b7c commit d15f9cd

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/Elasticsearch/Tests/ClientTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ public function testInlineHosts()
277277
])->build();
278278
$host = $client->transport->getConnection();
279279
$this->assertSame("localhost", $host->getHost());
280+
$this->assertSame("9200", $host->getPort());
280281
$this->assertSame("http", $host->getTransportSchema());
281282

282283

@@ -285,20 +286,23 @@ public function testInlineHosts()
285286
])->build();
286287
$host = $client->transport->getConnection();
287288
$this->assertSame("localhost", $host->getHost());
289+
$this->assertSame("9200", $host->getPort());
288290
$this->assertSame("http", $host->getTransportSchema());
289291

290292
$client = Elasticsearch\ClientBuilder::create()->setHosts([
291293
'http://foo.com:9200'
292294
])->build();
293295
$host = $client->transport->getConnection();
294296
$this->assertSame("foo.com", $host->getHost());
297+
$this->assertSame("9200", $host->getPort());
295298
$this->assertSame("http", $host->getTransportSchema());
296299

297300
$client = Elasticsearch\ClientBuilder::create()->setHosts([
298301
'https://foo.com:9200'
299302
])->build();
300303
$host = $client->transport->getConnection();
301304
$this->assertSame("foo.com", $host->getHost());
305+
$this->assertSame("9200", $host->getPort());
302306
$this->assertSame("https", $host->getTransportSchema());
303307

304308

@@ -307,6 +311,7 @@ public function testInlineHosts()
307311
])->build();
308312
$host = $client->transport->getConnection();
309313
$this->assertSame("foo.com", $host->getHost());
314+
$this->assertSame("9200", $host->getPort());
310315
$this->assertSame("https", $host->getTransportSchema());
311316
$this->assertSame("user:pass", $host->getUserPass());
312317
}
@@ -322,6 +327,7 @@ public function testExtendedHosts()
322327
])->build();
323328
$host = $client->transport->getConnection();
324329
$this->assertSame("localhost", $host->getHost());
330+
$this->assertSame("9200", $host->getPort());
325331
$this->assertSame("http", $host->getTransportSchema());
326332

327333

@@ -334,6 +340,7 @@ public function testExtendedHosts()
334340
])->build();
335341
$host = $client->transport->getConnection();
336342
$this->assertSame("foo.com", $host->getHost());
343+
$this->assertSame("9200", $host->getPort());
337344
$this->assertSame("http", $host->getTransportSchema());
338345

339346

@@ -346,6 +353,7 @@ public function testExtendedHosts()
346353
])->build();
347354
$host = $client->transport->getConnection();
348355
$this->assertSame("foo.com", $host->getHost());
356+
$this->assertSame("9200", $host->getPort());
349357
$this->assertSame("https", $host->getTransportSchema());
350358

351359

@@ -357,6 +365,7 @@ public function testExtendedHosts()
357365
])->build();
358366
$host = $client->transport->getConnection();
359367
$this->assertSame("foo.com", $host->getHost());
368+
$this->assertSame("9200", $host->getPort());
360369
$this->assertSame("http", $host->getTransportSchema());
361370

362371

@@ -367,6 +376,7 @@ public function testExtendedHosts()
367376
])->build();
368377
$host = $client->transport->getConnection();
369378
$this->assertSame("foo.com", $host->getHost());
379+
$this->assertSame("9200", $host->getPort());
370380
$this->assertSame("http", $host->getTransportSchema());
371381

372382

@@ -379,6 +389,7 @@ public function testExtendedHosts()
379389
])->build();
380390
$host = $client->transport->getConnection();
381391
$this->assertSame("foo.com", $host->getHost());
392+
$this->assertSame("9500", $host->getPort());
382393
$this->assertSame("https", $host->getTransportSchema());
383394

384395

@@ -402,6 +413,7 @@ public function testExtendedHosts()
402413
])->build();
403414
$host = $client->transport->getConnection();
404415
$this->assertSame("the_foo.com", $host->getHost());
416+
$this->assertSame("9200", $host->getPort());
405417
$this->assertSame("http", $host->getTransportSchema());
406418

407419

@@ -415,6 +427,7 @@ public function testExtendedHosts()
415427
])->build();
416428
$host = $client->transport->getConnection();
417429
$this->assertSame("foo.com", $host->getHost());
430+
$this->assertSame("9200", $host->getPort());
418431
$this->assertSame("http", $host->getTransportSchema());
419432
$this->assertSame("user:abc#$@?%!abc", $host->getUserPass());
420433
}

0 commit comments

Comments
 (0)