11
11
12
12
namespace Http \Adapter \Tests ;
13
13
14
- use Http \Adapter \ HttpAdapter ;
15
- use Http \Adapter \ HttpAdapterException ;
16
- use Http \Adapter \Exception \MultiHttpAdapterException ;
14
+ use Http \Client \ HttpClient ;
15
+ use Http \Client \ Exception \ RequestException ;
16
+ use Http \Client \Exception \BatchException ;
17
17
use Http \Message \MessageFactory ;
18
18
use Http \Discovery \MessageFactoryDiscovery ;
19
19
use Nerd \CartesianProduct \CartesianProduct ;
@@ -36,7 +36,7 @@ abstract class HttpAdapterTest extends \PHPUnit_Framework_TestCase
36
36
protected static $ messageFactory ;
37
37
38
38
/**
39
- * @var HttpAdapter
39
+ * @var HttpClient
40
40
*/
41
41
protected $ httpAdapter ;
42
42
@@ -97,7 +97,7 @@ protected function tearDown()
97
97
abstract public function testGetName ();
98
98
99
99
/**
100
- * @return HttpAdapter
100
+ * @return HttpClient
101
101
*/
102
102
abstract protected function createHttpAdapter ();
103
103
@@ -157,7 +157,7 @@ public function testSendRequestWithOutcome($uriAndOutcome, $protocolVersion, arr
157
157
}
158
158
159
159
/**
160
- * @expectedException \Http\Adapter \Exception\HttpAdapterException
160
+ * @expectedException \Http\Client \Exception
161
161
* @group integration
162
162
*/
163
163
public function testSendWithInvalidUri ()
@@ -178,9 +178,9 @@ public function testSendWithInvalidUri()
178
178
*/
179
179
public function testSendRequests (array $ requests )
180
180
{
181
- $ responses = $ this ->httpAdapter ->sendRequests ($ requests );
181
+ $ batchResult = $ this ->httpAdapter ->sendRequests ($ requests );
182
182
183
- $ this ->assertMultiResponses ($ responses , $ requests );
183
+ $ this ->assertMultiResponses ($ batchResult -> getResponses () , $ requests );
184
184
}
185
185
186
186
/**
@@ -192,9 +192,9 @@ public function testSendErroredRequests(array $requests, array $erroredRequests)
192
192
try {
193
193
$ this ->httpAdapter ->sendRequests (array_merge ($ requests , $ erroredRequests ));
194
194
$ this ->fail ();
195
- } catch (MultiHttpAdapterException $ e ) {
196
- $ this ->assertMultiResponses ($ e ->getResponses (), $ requests );
197
- $ this ->assertMultiExceptions ($ e ->getExceptions (), $ erroredRequests );
195
+ } catch (BatchException $ e ) {
196
+ $ this ->assertMultiResponses ($ e ->getResult ()-> getResponses (), $ requests );
197
+ $ this ->assertMultiExceptions ($ e ->getResult ()-> getExceptions (), $ erroredRequests );
198
198
}
199
199
}
200
200
@@ -470,15 +470,14 @@ private function assertMultiResponses(array $responses, array $requests)
470
470
}
471
471
472
472
/**
473
- * @param HttpAdapterException [] $exceptions
474
- * @param array $requests
473
+ * @param RequestException [] $exceptions
474
+ * @param array $requests
475
475
*/
476
476
private function assertMultiExceptions (array $ exceptions , array $ requests )
477
477
{
478
478
$ this ->assertCount (count ($ requests ), $ exceptions );
479
479
480
480
foreach ($ exceptions as $ exception ) {
481
- $ this ->assertTrue ($ exception ->hasRequest ());
482
481
$ this ->assertInstanceOf (
483
482
'Psr\Http\Message\RequestInterface ' ,
484
483
$ exception ->getRequest ()
0 commit comments