diff --git a/src/HttpAsyncClientTest.php b/src/HttpAsyncClientTest.php index 2daa27f..ceedb91 100644 --- a/src/HttpAsyncClientTest.php +++ b/src/HttpAsyncClientTest.php @@ -41,14 +41,16 @@ public function testSuccessiveCallMustUseResponseInterface() ); $promise = $this->httpAsyncClient->sendAsyncRequest($request); - $this->assertInstanceOf('Http\Client\Promise', $promise); + $this->assertInstanceOf('Http\Promise\Promise', $promise); $response = null; $promise->then()->then()->then(function ($r) use(&$response) { $response = $r; + + return $response; }); - $promise->wait(); + $promise->wait(false); $this->assertResponse( $response, [ @@ -66,17 +68,21 @@ public function testSuccessiveInvalidCallMustUseException() ); $promise = $this->httpAsyncClient->sendAsyncRequest($request); - $this->assertInstanceOf('Http\Client\Promise', $promise); + $this->assertInstanceOf('Http\Promise\Promise', $promise); $exception = null; $response = null; $promise->then()->then()->then(function ($r) use(&$response) { $response = $r; + + return $response; }, function ($e) use (&$exception) { $exception = $e; + + throw $e; }); - $promise->wait(); + $promise->wait(false); $this->assertNull($response); $this->assertNotNull($exception); @@ -101,11 +107,13 @@ public function testAsyncSendRequest($method, $uri, array $headers, $body) ); $promise = $this->httpAsyncClient->sendAsyncRequest($request); - $this->assertInstanceOf('Http\Client\Promise', $promise); + $this->assertInstanceOf('Http\Promise\Promise', $promise); $response = null; $promise->then(function ($r) use(&$response) { $response = $r; + + return $response; }); $promise->wait(); @@ -132,14 +140,18 @@ public function testSendAsyncWithInvalidUri() $exception = null; $response = null; $promise = $this->httpAsyncClient->sendAsyncRequest($request); - $this->assertInstanceOf('Http\Client\Promise', $promise); + $this->assertInstanceOf('Http\Promise\Promise', $promise); $promise->then(function ($r) use(&$response) { $response = $r; + + return $response; }, function ($e) use (&$exception) { $exception = $e; + + throw $e; }); - $promise->wait(); + $promise->wait(false); $this->assertNull($response); $this->assertNotNull($exception); @@ -175,9 +187,11 @@ public function testSendAsyncRequestWithOutcome($uriAndOutcome, $protocolVersion $promise = $this->httpAsyncClient->sendAsyncRequest($request); $promise->then(function ($r) use(&$response) { $response = $r; + + return $response; }); - $this->assertInstanceOf('Http\Client\Promise', $promise); + $this->assertInstanceOf('Http\Promise\Promise', $promise); $promise->wait(); $this->assertResponse( $response, @@ -186,4 +200,3 @@ public function testSendAsyncRequestWithOutcome($uriAndOutcome, $protocolVersion $this->assertRequest($method, $headers, $body, $protocolVersion); } } - \ No newline at end of file