File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed
tests/Elasticsearch/Tests Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -1550,9 +1550,9 @@ private function verifyNotNullOrEmpty(string $name, $var)
15501550 }
15511551
15521552 /**
1553- * @throws \Exception
1553+ * @return callable|array
15541554 */
1555- private function performRequest (AbstractEndpoint $ endpoint ): array
1555+ private function performRequest (AbstractEndpoint $ endpoint )
15561556 {
15571557 $ promise = $ this ->transport ->performRequest (
15581558 $ endpoint ->getMethod (),
Original file line number Diff line number Diff line change 88use Elasticsearch \Client ;
99use Elasticsearch \ClientBuilder ;
1010use Elasticsearch \Common \Exceptions \MaxRetriesException ;
11+ use GuzzleHttp \Ring \Client \MockHandler ;
12+ use GuzzleHttp \Ring \Future \FutureArray ;
1113use Mockery as m ;
1214
1315/**
@@ -445,4 +447,28 @@ public function testExtendedHosts()
445447 $ this ->assertSame ("http " , $ host ->getTransportSchema ());
446448 $ this ->assertSame ("user:abc#$@?%!abc " , $ host ->getUserPass ());
447449 }
450+
451+ public function testClientLazy ()
452+ {
453+ $ handler = new MockHandler ([
454+ 'status ' => 200 ,
455+ 'transfer_stats ' => [
456+ 'total_time ' => 100
457+ ],
458+ 'body ' => '{test} ' ,
459+ 'effective_url ' => 'localhost '
460+ ]);
461+ $ builder = ClientBuilder::create ();
462+ $ builder ->setHosts (['somehost ' ]);
463+ $ builder ->setHandler ($ handler );
464+ $ client = $ builder ->build ();
465+
466+ $ params = [
467+ 'client ' => [
468+ 'future ' => 'lazy ' ,
469+ ]
470+ ];
471+ $ result = $ client ->info ($ params );
472+ $ this ->assertInstanceOf (FutureArray::class, $ result );
473+ }
448474}
You can’t perform that action at this time.
0 commit comments