Skip to content

Commit cbb22ef

Browse files
committed
Add test on passing options from the client builder to the client
1 parent 0c0a37d commit cbb22ef

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/PluginClientBuilderTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,29 @@ function (): array {
4949
$this->assertSame($expected, $plugged);
5050
}
5151

52+
/** @dataProvider clientProvider */
53+
public function testOptions(string $client): void
54+
{
55+
$builder = new PluginClientBuilder();
56+
$builder->setOption('max_restarts', 5);
57+
58+
$client = $this->prophesize($client)->reveal();
59+
$client = $builder->createClient($client);
60+
61+
$closure = Closure::bind(
62+
function (): array {
63+
return $this->options;
64+
},
65+
$client,
66+
PluginClient::class
67+
);
68+
69+
$options = $closure();
70+
71+
$this->assertArrayHasKey('max_restarts', $options);
72+
$this->assertSame(5, $options['max_restarts']);
73+
}
74+
5275
public function clientProvider(): iterable
5376
{
5477
yield 'sync\'d http client' => [HttpClient::class];

0 commit comments

Comments
 (0)