File tree 2 files changed +28
-2
lines changed
tests/Elasticsearch/Tests
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)
1550
1550
}
1551
1551
1552
1552
/**
1553
- * @throws \Exception
1553
+ * @return callable|array
1554
1554
*/
1555
- private function performRequest (AbstractEndpoint $ endpoint ): array
1555
+ private function performRequest (AbstractEndpoint $ endpoint )
1556
1556
{
1557
1557
$ promise = $ this ->transport ->performRequest (
1558
1558
$ endpoint ->getMethod (),
Original file line number Diff line number Diff line change 8
8
use Elasticsearch \Client ;
9
9
use Elasticsearch \ClientBuilder ;
10
10
use Elasticsearch \Common \Exceptions \MaxRetriesException ;
11
+ use GuzzleHttp \Ring \Client \MockHandler ;
12
+ use GuzzleHttp \Ring \Future \FutureArray ;
11
13
use Mockery as m ;
12
14
13
15
/**
@@ -445,4 +447,28 @@ public function testExtendedHosts()
445
447
$ this ->assertSame ("http " , $ host ->getTransportSchema ());
446
448
$ this ->assertSame ("user:abc#$@?%!abc " , $ host ->getUserPass ());
447
449
}
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
+ }
448
474
}
You can’t perform that action at this time.
0 commit comments