Skip to content

Commit 9d208e2

Browse files
authored
Support for more clients versions (#294)
* Support for clients * Removed most clients from composer.json * Use mock-client 1.2 * minor
1 parent 599e7d4 commit 9d208e2

File tree

8 files changed

+32
-8
lines changed

8 files changed

+32
-8
lines changed

.travis.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ env:
1515

1616
branches:
1717
except:
18-
- /^analysis-.*$/
18+
- /^patch-.*$/
1919

2020
matrix:
2121
fast_finish: true
@@ -43,6 +43,14 @@ matrix:
4343
- php: 7.3
4444
env: DEPENDENCIES="dunglas/symfony-lock:^4"
4545

46+
# Test with httplug 1.x clients
47+
- php: 7.2
48+
env: DEPENDENCIES="php-http/buzz-adapter:^1.0 php-http/curl-client:^1.0 php-http/guzzle6-adapter:^1.1.1 php-http/react-adapter:^0.2.1 php-http/socket-client:^1.0"
49+
50+
# Test with httplug 2.x clients
51+
- php: 7.2
52+
env: DEPENDENCIES="php-http/guzzle6-adapter:^2.0.1"
53+
4654
# Latest commit to master
4755
- php: 7.3
4856
env: STABILITY="dev"

Tests/Resources/app/config/config_test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ httplug:
77
async_client: auto
88
clients:
99
acme:
10-
factory: httplug.factory.curl
10+
factory: httplug.factory.guzzle6
1111
plugins:
1212
-
1313
decoder:

Tests/Unit/ClientFactory/BuzzFactoryTest.php

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ class BuzzFactoryTest extends TestCase
1414
{
1515
public function testCreateClient()
1616
{
17+
if (!class_exists(\Http\Adapter\Buzz\Client::class)) {
18+
$this->markTestSkipped('Buzz adapter is not installed');
19+
}
20+
1721
$factory = new BuzzFactory($this->getMockBuilder(MessageFactory::class)->getMock());
1822
$client = $factory->createClient();
1923

Tests/Unit/ClientFactory/CurlFactoryTest.php

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ class CurlFactoryTest extends TestCase
1515
{
1616
public function testCreateClient()
1717
{
18+
if (!class_exists(\Http\Client\Curl\Client::class)) {
19+
$this->markTestSkipped('Curl client is not installed');
20+
}
21+
1822
$factory = new CurlFactory(
1923
$this->getMockBuilder(MessageFactory::class)->getMock(),
2024
$this->getMockBuilder(StreamFactory::class)->getMock()

Tests/Unit/ClientFactory/Guzzle6FactoryTest.php

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ class Guzzle6FactoryTest extends TestCase
1313
{
1414
public function testCreateClient()
1515
{
16+
if (!class_exists(\Http\Adapter\Guzzle6\Client::class)) {
17+
$this->markTestSkipped('Guzzle6 adapter is not installed');
18+
}
19+
1620
$factory = new Guzzle6Factory();
1721
$client = $factory->createClient();
1822

Tests/Unit/ClientFactory/ReactFactoryTest.php

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ class ReactFactoryTest extends TestCase
1414
{
1515
public function testCreateClient()
1616
{
17+
if (!class_exists(\Http\Adapter\React\Client::class)) {
18+
$this->markTestSkipped('React adapter is not installed');
19+
}
20+
1721
$factory = new ReactFactory($this->getMockBuilder(MessageFactory::class)->getMock());
1822
$client = $factory->createClient();
1923

Tests/Unit/ClientFactory/SocketFactoryTest.php

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ class SocketFactoryTest extends TestCase
1414
{
1515
public function testCreateClient()
1616
{
17+
if (!class_exists(\Http\Client\Socket\Client::class)) {
18+
$this->markTestSkipped('Socket client is not installed');
19+
}
20+
1721
$factory = new SocketFactory($this->getMockBuilder(MessageFactory::class)->getMock());
1822
$client = $factory->createClient();
1923

composer.json

+2-6
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,9 @@
3838
"guzzlehttp/psr7": "^1.0",
3939
"matthiasnoback/symfony-dependency-injection-test": "^1.1 || ^2.3",
4040
"nyholm/nsa": "^1.1",
41-
"php-http/buzz-adapter": "^0.3",
42-
"php-http/curl-client": "^1.0",
43-
"php-http/guzzle6-adapter": "^1.1.1",
44-
"php-http/mock-client": "^1.0",
41+
"php-http/guzzle6-adapter": "^1.1.1 || ^2.0.1",
4542
"php-http/promise": "^1.0",
46-
"php-http/react-adapter": "^0.2.1",
47-
"php-http/socket-client": "^1.0",
43+
"php-http/mock-client": "^1.2",
4844
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
4945
"symfony/browser-kit": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
5046
"symfony/cache": "^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",

0 commit comments

Comments
 (0)