forked from php-http/guzzle6-adapter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request php-http#25 from php-http/subnamespace
Move adapter into subnamespace
- Loading branch information
Showing
13 changed files
with
41 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<?php | ||
|
||
namespace Http\Adapter; | ||
namespace Http\Adapter\Guzzle6; | ||
|
||
use GuzzleHttp\Client; | ||
use GuzzleHttp\Client as GuzzleClient; | ||
use GuzzleHttp\ClientInterface; | ||
use GuzzleHttp\HandlerStack; | ||
use GuzzleHttp\Middleware; | ||
|
@@ -16,7 +16,7 @@ | |
* | ||
* @author David de Boer <[email protected]> | ||
*/ | ||
class Guzzle6HttpAdapter implements HttpClient, HttpAsyncClient | ||
class Client implements HttpClient, HttpAsyncClient | ||
{ | ||
use HttpClientEmulator; | ||
|
||
|
@@ -33,7 +33,7 @@ public function __construct(ClientInterface $client = null) | |
if (!$client) { | ||
$handlerStack = new HandlerStack(\GuzzleHttp\choose_handler()); | ||
$handlerStack->push(Middleware::prepareBody(), 'prepare_body'); | ||
$client = new Client(['handler' => $handlerStack]); | ||
$client = new GuzzleClient(['handler' => $handlerStack]); | ||
} | ||
$this->client = $client; | ||
} | ||
|
@@ -45,6 +45,6 @@ public function sendAsyncRequest(RequestInterface $request) | |
{ | ||
$promise = $this->client->sendAsync($request); | ||
|
||
return new Guzzle6Promise($promise, $request); | ||
return new Promise($promise, $request); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
<?php | ||
|
||
namespace Http\Adapter; | ||
namespace Http\Adapter\Guzzle6; | ||
|
||
use GuzzleHttp\Exception as GuzzleExceptions; | ||
use GuzzleHttp\Promise\PromiseInterface; | ||
use Http\Client\Exception as HttplugException; | ||
use Http\Promise\Promise; | ||
use Http\Promise\Promise as HttpPromise; | ||
use Psr\Http\Message\RequestInterface; | ||
use Psr\Http\Message\ResponseInterface; | ||
|
||
|
@@ -14,7 +14,7 @@ | |
* | ||
* @author Joel Wurtz <[email protected]> | ||
*/ | ||
class Guzzle6Promise implements Promise | ||
class Promise implements HttpPromise | ||
{ | ||
/** | ||
* @var PromiseInterface | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
|
||
namespace Http\Adapter\Tests; | ||
namespace Http\Adapter\Guzzle6\Tests; | ||
|
||
use GuzzleHttp\Handler\CurlHandler; | ||
|
||
|
@@ -9,7 +9,7 @@ | |
* | ||
* @author GeLo <[email protected]> | ||
*/ | ||
class Guzzle6CurlHttpAdapterTest extends Guzzle6HttpAdapterTest | ||
class CurlHttpAdapterTest extends HttpAdapterTest | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
|
||
namespace Http\Adapter\Tests; | ||
namespace Http\Adapter\Guzzle6\Tests; | ||
|
||
use GuzzleHttp\Handler\CurlHandler; | ||
|
||
|
@@ -9,7 +9,7 @@ | |
* | ||
* @author Joel Wurtz <[email protected]> | ||
*/ | ||
class Guzzle6CurlHttpAsyncAdapterTest extends Guzzle6HttpAsyncAdapterTest | ||
class CurlHttpAsyncAdapterTest extends HttpAsyncAdapterTest | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
|
10 changes: 5 additions & 5 deletions
10
tests/Guzzle6HttpAdapterTest.php → tests/HttpAdapterTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
<?php | ||
|
||
namespace Http\Adapter\Tests; | ||
namespace Http\Adapter\Guzzle6\Tests; | ||
|
||
use GuzzleHttp\Client; | ||
use Http\Adapter\Guzzle6HttpAdapter; | ||
use GuzzleHttp\Client as GuzzleClient; | ||
use Http\Adapter\Guzzle6\Client; | ||
use Http\Client\Tests\HttpClientTest; | ||
|
||
/** | ||
* @author GeLo <[email protected]> | ||
*/ | ||
abstract class Guzzle6HttpAdapterTest extends HttpClientTest | ||
abstract class HttpAdapterTest extends HttpClientTest | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function createHttpAdapter() | ||
{ | ||
return new Guzzle6HttpAdapter(new Client(['handler' => $this->createHandler()])); | ||
return new Client(new GuzzleClient(['handler' => $this->createHandler()])); | ||
} | ||
|
||
/** | ||
|
10 changes: 5 additions & 5 deletions
10
tests/Guzzle6HttpAsyncAdapterTest.php → tests/HttpAsyncAdapterTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
<?php | ||
|
||
namespace Http\Adapter\Tests; | ||
namespace Http\Adapter\Guzzle6\Tests; | ||
|
||
use GuzzleHttp\Client; | ||
use Http\Adapter\Guzzle6HttpAdapter; | ||
use GuzzleHttp\Client as GuzzleClient; | ||
use Http\Adapter\Guzzle6\Client; | ||
use Http\Client\Tests\HttpAsyncClientTest; | ||
|
||
/** | ||
* @author Joel Wurtz <[email protected]> | ||
*/ | ||
abstract class Guzzle6HttpAsyncAdapterTest extends HttpAsyncClientTest | ||
abstract class HttpAsyncAdapterTest extends HttpAsyncClientTest | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function createHttpAsyncClient() | ||
{ | ||
return new Guzzle6HttpAdapter(new Client(['handler' => $this->createHandler()])); | ||
return new Client(new GuzzleClient(['handler' => $this->createHandler()])); | ||
} | ||
|
||
/** | ||
|
4 changes: 2 additions & 2 deletions
4
tests/Guzzle6MultiCurlHttpAdapterTest.php → tests/MultiCurlHttpAdapterTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
<?php | ||
|
||
namespace Http\Adapter\Tests; | ||
namespace Http\Adapter\Guzzle6\Tests; | ||
|
||
use GuzzleHttp\Handler\CurlMultiHandler; | ||
|
||
/** | ||
* @author GeLo <[email protected]> | ||
*/ | ||
class Guzzle6MultiCurlHttpAdapterTest extends Guzzle6HttpAdapterTest | ||
class MultiCurlHttpAdapterTest extends HttpAdapterTest | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
|
4 changes: 2 additions & 2 deletions
4
.../Guzzle6MultiCurlHttpAsyncAdapterTest.php → tests/MultiCurlHttpAsyncAdapterTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
<?php | ||
|
||
namespace Http\Adapter\Tests; | ||
namespace Http\Adapter\Guzzle6\Tests; | ||
|
||
use GuzzleHttp\Handler\CurlMultiHandler; | ||
|
||
/** | ||
* @author Joel Wurtz <[email protected]> | ||
*/ | ||
class Guzzle6MultiCurlHttpAsyncAdapterTest extends Guzzle6HttpAsyncAdapterTest | ||
class MultiCurlHttpAsyncAdapterTest extends HttpAsyncAdapterTest | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
|
10 changes: 5 additions & 5 deletions
10
tests/Guzzle6PromiseExceptionTest.php → tests/PromiseExceptionTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
<?php | ||
|
||
namespace Http\Adapter\Tests; | ||
namespace Http\Adapter\Guzzle6\Tests; | ||
|
||
use GuzzleHttp\Exception as GuzzleExceptions; | ||
use Http\Adapter\Guzzle6Promise; | ||
use Http\Adapter\Guzzle6\Promise; | ||
|
||
/** | ||
* @author Tobias Nyholm <[email protected]> | ||
*/ | ||
class Guzzle6PromiseExceptionTest extends \PHPUnit_Framework_TestCase | ||
class PromiseExceptionTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testGetException() | ||
{ | ||
$request = $this->getMock('Psr\Http\Message\RequestInterface'); | ||
$response = $this->getMock('Psr\Http\Message\ResponseInterface'); | ||
$promise = $this->getMock('GuzzleHttp\Promise\PromiseInterface'); | ||
|
||
$adapter = new Guzzle6Promise($promise, $request); | ||
$method = new \ReflectionMethod('Http\Adapter\Guzzle6Promise', 'handleException'); | ||
$adapter = new Promise($promise, $request); | ||
$method = new \ReflectionMethod('Http\Adapter\Guzzle6\Promise', 'handleException'); | ||
$method->setAccessible(true); | ||
|
||
$outputException = $method->invoke($adapter, new GuzzleExceptions\ConnectException('foo', $request), $request); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
<?php | ||
|
||
namespace Http\Adapter\Tests; | ||
namespace Http\Adapter\Guzzle6\Tests; | ||
|
||
use GuzzleHttp\Exception as GuzzleExceptions; | ||
use GuzzleHttp\Promise\RejectedPromise; | ||
use Http\Adapter\Guzzle6Promise; | ||
use Http\Adapter\Guzzle6\Promise; | ||
|
||
/** | ||
* @author Márk Sági-Kazár <[email protected]> | ||
*/ | ||
class Guzzle6PromiseTest extends \PHPUnit_Framework_TestCase | ||
class PromiseTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @expectedException \Exception | ||
|
@@ -19,7 +19,7 @@ public function testNonDomainExceptionIsHandled() | |
$request = $this->prophesize('Psr\Http\Message\RequestInterface'); | ||
$promise = new RejectedPromise(new \Exception()); | ||
|
||
$guzzlePromise = new Guzzle6Promise($promise, $request->reveal()); | ||
$guzzlePromise = new Promise($promise, $request->reveal()); | ||
|
||
$guzzlePromise->wait(); | ||
} | ||
|
4 changes: 2 additions & 2 deletions
4
tests/Guzzle6StreamHttpAdapterTest.php → tests/StreamHttpAdapterTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
<?php | ||
|
||
namespace Http\Adapter\Tests; | ||
namespace Http\Adapter\Guzzle6\Tests; | ||
|
||
use GuzzleHttp\Handler\StreamHandler; | ||
|
||
/** | ||
* @author GeLo <[email protected]> | ||
*/ | ||
class Guzzle6StreamHttpAdapterTest extends Guzzle6HttpAdapterTest | ||
class StreamHttpAdapterTest extends HttpAdapterTest | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
|
4 changes: 2 additions & 2 deletions
4
tests/Guzzle6StreamHttpAsyncAdapterTest.php → tests/StreamHttpAsyncAdapterTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
<?php | ||
|
||
namespace Http\Adapter\Tests; | ||
namespace Http\Adapter\Guzzle6\Tests; | ||
|
||
use GuzzleHttp\Handler\StreamHandler; | ||
|
||
/** | ||
* @author Joel Wurtz <[email protected]> | ||
*/ | ||
class Guzzle6StreamHttpAsyncAdapterTest extends Guzzle6HttpAsyncAdapterTest | ||
class StreamHttpAsyncAdapterTest extends HttpAsyncAdapterTest | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
|