1010use Prophecy \Argument ;
1111use Psr \Http \Message \RequestInterface ;
1212use Psr \Http \Message \ResponseInterface ;
13+ use Http \Client \Common \HttpClientPool \LeastUsedClientPool ;
14+ use Http \Client \Common \Exception \HttpClientNotFoundException ;
15+ use Http \Client \Exception \HttpException ;
1316
1417class LeastUsedClientPoolSpec extends ObjectBehavior
1518{
1619 public function it_is_initializable ()
1720 {
18- $ this ->shouldHaveType (' Http\Client\Common\HttpClientPool\ LeastUsedClientPool' );
21+ $ this ->shouldHaveType (LeastUsedClientPool::class );
1922 }
2023
2124 public function it_is_an_http_client ()
2225 {
23- $ this ->shouldImplement (' Http\Client\ HttpClient' );
26+ $ this ->shouldImplement (HttpClient::class );
2427 }
2528
2629 public function it_is_an_async_http_client ()
2730 {
28- $ this ->shouldImplement (' Http\Client\ HttpAsyncClient' );
31+ $ this ->shouldImplement (HttpAsyncClient::class );
2932 }
3033
3134 public function it_throw_exception_with_no_client (RequestInterface $ request )
3235 {
33- $ this ->shouldThrow (' Http\Client\Common\Exception\ HttpClientNotFoundException' )->duringSendRequest ($ request );
34- $ this ->shouldThrow (' Http\Client\Common\Exception\ HttpClientNotFoundException' )->duringSendAsyncRequest ($ request );
36+ $ this ->shouldThrow (HttpClientNotFoundException::class )->duringSendRequest ($ request );
37+ $ this ->shouldThrow (HttpClientNotFoundException::class )->duringSendAsyncRequest ($ request );
3538 }
3639
3740 public function it_sends_request (HttpClient $ httpClient , RequestInterface $ request , ResponseInterface $ response )
@@ -54,19 +57,19 @@ public function it_sends_async_request(HttpAsyncClient $httpAsyncClient, Request
5457 public function it_throw_exception_if_no_more_enable_client (HttpClient $ client , RequestInterface $ request )
5558 {
5659 $ this ->addHttpClient ($ client );
57- $ client ->sendRequest ($ request )->willThrow (' Http\Client\Exception\ HttpException' );
60+ $ client ->sendRequest ($ request )->willThrow (HttpException::class );
5861
59- $ this ->shouldThrow (' Http\Client\Exception\ HttpException' )->duringSendRequest ($ request );
60- $ this ->shouldThrow (' Http\Client\Common\Exception\ HttpClientNotFoundException' )->duringSendRequest ($ request );
62+ $ this ->shouldThrow (HttpException::class )->duringSendRequest ($ request );
63+ $ this ->shouldThrow (HttpClientNotFoundException::class )->duringSendRequest ($ request );
6164 }
6265
6366 public function it_reenable_client (HttpClient $ client , RequestInterface $ request )
6467 {
6568 $ this ->addHttpClient (new HttpClientPoolItem ($ client ->getWrappedObject (), 0 ));
66- $ client ->sendRequest ($ request )->willThrow (' Http\Client\Exception\ HttpException' );
69+ $ client ->sendRequest ($ request )->willThrow (HttpException::class );
6770
68- $ this ->shouldThrow (' Http\Client\Exception\ HttpException' )->duringSendRequest ($ request );
69- $ this ->shouldThrow (' Http\Client\Exception\ HttpException' )->duringSendRequest ($ request );
71+ $ this ->shouldThrow (HttpException::class )->duringSendRequest ($ request );
72+ $ this ->shouldThrow (HttpException::class )->duringSendRequest ($ request );
7073 }
7174
7275 public function it_uses_the_lowest_request_client (HttpClientPoolItem $ client1 , HttpClientPoolItem $ client2 , RequestInterface $ request , ResponseInterface $ response )
0 commit comments