66use Http \Client \Exception \NetworkException ;
77use Mockery as m ;
88use GuzzleHttp \Psr7 \Request ;
9- use Http \Client \HttpClient ;
10- use Http \Message \RequestFactory ;
119use Omnipay \Common \Http \Exception \RequestException ;
1210use Omnipay \Tests \TestCase ;
11+ use Psr \Http \Client \ClientInterface ;
12+ use Psr \Http \Message \RequestFactoryInterface ;
1313
1414class ClientTest extends TestCase
1515{
1616 public function testEmptyConstruct ()
1717 {
1818 $ client = new Client ();
1919
20- $ this ->assertAttributeInstanceOf (HttpClient ::class, 'httpClient ' , $ client );
21- $ this ->assertAttributeInstanceOf (RequestFactory ::class, 'requestFactory ' , $ client );
20+ $ this ->assertAttributeInstanceOf (ClientInterface ::class, 'httpClient ' , $ client );
21+ $ this ->assertAttributeInstanceOf (RequestFactoryInterface ::class, 'requestFactory ' , $ client );
2222 }
2323
2424 public function testSend ()
2525 {
26- $ mockClient = m::mock (HttpClient ::class);
27- $ mockFactory = m::mock (RequestFactory ::class);
26+ $ mockClient = m::mock (ClientInterface ::class);
27+ $ mockFactory = m::mock (RequestFactoryInterface ::class);
2828 $ client = new Client ($ mockClient , $ mockFactory );
2929
3030 $ request = new Request ('GET ' , '/path ' );
@@ -33,9 +33,6 @@ public function testSend()
3333 $ mockFactory ->shouldReceive ('createRequest ' )->withArgs ([
3434 'GET ' ,
3535 '/path ' ,
36- [],
37- null ,
38- '1.1 ' ,
3936 ])->andReturn ($ request );
4037
4138 $ mockClient ->shouldReceive ('sendRequest ' )
@@ -49,8 +46,8 @@ public function testSend()
4946
5047 public function testSendException ()
5148 {
52- $ mockClient = m::mock (HttpClient ::class);
53- $ mockFactory = m::mock (RequestFactory ::class);
49+ $ mockClient = m::mock (ClientInterface ::class);
50+ $ mockFactory = m::mock (RequestFactoryInterface ::class);
5451 $ client = new Client ($ mockClient , $ mockFactory );
5552
5653 $ request = new Request ('GET ' , '/path ' );
@@ -59,9 +56,6 @@ public function testSendException()
5956 $ mockFactory ->shouldReceive ('createRequest ' )->withArgs ([
6057 'GET ' ,
6158 '/path ' ,
62- [],
63- null ,
64- '1.1 ' ,
6559 ])->andReturn ($ request );
6660
6761 $ mockClient ->shouldReceive ('sendRequest ' )
@@ -76,8 +70,8 @@ public function testSendException()
7670
7771 public function testSendNetworkException ()
7872 {
79- $ mockClient = m::mock (HttpClient ::class);
80- $ mockFactory = m::mock (RequestFactory ::class);
73+ $ mockClient = m::mock (ClientInterface ::class);
74+ $ mockFactory = m::mock (RequestFactoryInterface ::class);
8175 $ client = new Client ($ mockClient , $ mockFactory );
8276
8377 $ request = new Request ('GET ' , '/path ' );
@@ -86,9 +80,6 @@ public function testSendNetworkException()
8680 $ mockFactory ->shouldReceive ('createRequest ' )->withArgs ([
8781 'GET ' ,
8882 '/path ' ,
89- [],
90- null ,
91- '1.1 ' ,
9283 ])->andReturn ($ request );
9384
9485 $ mockClient ->shouldReceive ('sendRequest ' )
@@ -103,8 +94,8 @@ public function testSendNetworkException()
10394
10495 public function testSendExceptionGetRequest ()
10596 {
106- $ mockClient = m::mock (HttpClient ::class);
107- $ mockFactory = m::mock (RequestFactory ::class);
97+ $ mockClient = m::mock (ClientInterface ::class);
98+ $ mockFactory = m::mock (RequestFactoryInterface ::class);
10899 $ client = new Client ($ mockClient , $ mockFactory );
109100
110101 $ request = new Request ('GET ' , '/path ' );
@@ -113,9 +104,6 @@ public function testSendExceptionGetRequest()
113104 $ mockFactory ->shouldReceive ('createRequest ' )->withArgs ([
114105 'GET ' ,
115106 '/path ' ,
116- [],
117- null ,
118- '1.1 ' ,
119107 ])->andReturn ($ request );
120108
121109 $ exception = new \Exception ('Something went wrong ' );
0 commit comments