Skip to content

Commit 5e0cb12

Browse files
committed
Removed final and aadded the test back
1 parent 9080c21 commit 5e0cb12

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

spec/HttpClientPool/LeastUsedClientPoolSpec.php

+21
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,25 @@ public function it_reenable_client(HttpClient $client, RequestInterface $request
6969
$this->shouldThrow('Http\Client\Exception\HttpException')->duringSendRequest($request);
7070
$this->shouldThrow('Http\Client\Exception\HttpException')->duringSendRequest($request);
7171
}
72+
73+
public function it_uses_the_lowest_request_client(HttpClientPoolItem $client1, HttpClientPoolItem $client2, RequestInterface $request, ResponseInterface $response)
74+
{
75+
if (extension_loaded('xdebug')) {
76+
throw new SkippingException('This test fail when xdebug is enable on PHP < 7');
77+
}
78+
79+
$this->addHttpClient($client1);
80+
$this->addHttpClient($client2);
81+
82+
$client1->getSendingRequestCount()->willReturn(10);
83+
$client2->getSendingRequestCount()->willReturn(2);
84+
85+
$client1->isDisabled()->willReturn(false);
86+
$client2->isDisabled()->willReturn(false);
87+
88+
$client1->sendRequest($request)->shouldNotBeCalled();
89+
$client2->sendRequest($request)->willReturn($response);
90+
91+
$this->sendRequest($request)->shouldReturn($response);
92+
}
7293
}

src/HttpClientPoolItem.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function sendAsyncRequest(RequestInterface $request)
102102
*
103103
* @return bool
104104
*/
105-
final public function isDisabled()
105+
public function isDisabled()
106106
{
107107
$disabledAt = $this->getDisabledAt();
108108

@@ -129,7 +129,7 @@ final public function isDisabled()
129129
*
130130
* @return int
131131
*/
132-
final public function getSendingRequestCount()
132+
public function getSendingRequestCount()
133133
{
134134
return $this->sendingRequestCount;
135135
}

0 commit comments

Comments
 (0)