From 58b269c39dd522ba73c8cd095f4db61e3bf6b3ea Mon Sep 17 00:00:00 2001 From: David de Boer Date: Fri, 27 Nov 2020 08:45:35 +0100 Subject: [PATCH 01/27] Allow PHP 8 --- .travis.yml | 2 ++ CHANGELOG.md | 4 ++++ composer.json | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 678f7a6a..d91ec553 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,6 +54,8 @@ matrix: # Latest commit to master - php: 7.4 env: STABILITY="dev" DEPENDENCIES="php-http/vcr-plugin:^1.0@dev" + - php: 8.0 + env: STABILITY="dev" DEPENDENCIES="php-http/vcr-plugin:^1.0@dev" allow_failures: # dev stability is allowed to fail. diff --git a/CHANGELOG.md b/CHANGELOG.md index a7395b4e..8e178734 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release. +# 1.20.0 - to be released + +- Support PHP 8. + ## 1.19.0 - 2020-10-21 ### Changed diff --git a/composer.json b/composer.json index 8c61e378..099722ca 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2 || ^8.0", "php-http/client-common": "^1.9 || ^2.0", "php-http/client-implementation": "^1.0", "php-http/discovery": "^1.0", From c83ef6fe60e913ea7a1c391af019b2a41f84a15d Mon Sep 17 00:00:00 2001 From: David de Boer Date: Fri, 27 Nov 2020 10:53:45 +0100 Subject: [PATCH 02/27] Try 8.0snapshot --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d91ec553..f31972eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,7 +54,7 @@ matrix: # Latest commit to master - php: 7.4 env: STABILITY="dev" DEPENDENCIES="php-http/vcr-plugin:^1.0@dev" - - php: 8.0 + - php: 8.0snapshot env: STABILITY="dev" DEPENDENCIES="php-http/vcr-plugin:^1.0@dev" allow_failures: From de49841bd809ad9f3586d29de5414dca0cad40b9 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Mon, 30 Nov 2020 10:17:55 +0100 Subject: [PATCH 03/27] Test against stable deps --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f31972eb..c761c663 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,6 +30,7 @@ matrix: - php: 7.3 env: COVERAGE=true TEST_COMMAND="composer test-ci" DEPENDENCIES="php-http/vcr-plugin:^1.0@dev" - php: 7.4 + - php: 8.0snapshot # Test LTS versions - php: 7.3 @@ -55,7 +56,7 @@ matrix: - php: 7.4 env: STABILITY="dev" DEPENDENCIES="php-http/vcr-plugin:^1.0@dev" - php: 8.0snapshot - env: STABILITY="dev" DEPENDENCIES="php-http/vcr-plugin:^1.0@dev" + env: STABILITY="dev" allow_failures: # dev stability is allowed to fail. From 7381ea5049c9696e6c5ecfd7d283063e16e527dd Mon Sep 17 00:00:00 2001 From: David de Boer Date: Mon, 30 Nov 2020 12:53:11 +0100 Subject: [PATCH 04/27] Fix assertions --- tests/Unit/DependencyInjection/ConfigurationTest.php | 4 ++-- tests/Unit/DependencyInjection/HttplugExtensionTest.php | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/Unit/DependencyInjection/ConfigurationTest.php b/tests/Unit/DependencyInjection/ConfigurationTest.php index 20871ed3..b1e3ed2f 100644 --- a/tests/Unit/DependencyInjection/ConfigurationTest.php +++ b/tests/Unit/DependencyInjection/ConfigurationTest.php @@ -435,7 +435,7 @@ public function testClientCacheConfigMustHavePool(): void $file = __DIR__.'/../../Resources/Fixtures/config/client_cache_config_with_no_pool.yml'; $this->expectException(InvalidConfigurationException::class); - $this->expectExceptionMessage('The child node "cache_pool" at path "httplug.clients.test.plugins.0.cache" must be configured.'); + $this->expectExceptionMessage('httplug.clients.test.plugins.0.cache'); $this->assertProcessedConfigurationEquals([], [$file]); } @@ -444,7 +444,7 @@ public function testCacheConfigMustHavePool(): void $file = __DIR__.'/../../Resources/Fixtures/config/cache_config_with_no_pool.yml'; $this->expectException(InvalidConfigurationException::class); - $this->expectExceptionMessage('The child node "cache_pool" at path "httplug.plugins.cache" must be configured.'); + $this->expectExceptionMessage('cache_pool'); $this->assertProcessedConfigurationEquals([], [$file]); } diff --git a/tests/Unit/DependencyInjection/HttplugExtensionTest.php b/tests/Unit/DependencyInjection/HttplugExtensionTest.php index 662fda31..6afdec45 100644 --- a/tests/Unit/DependencyInjection/HttplugExtensionTest.php +++ b/tests/Unit/DependencyInjection/HttplugExtensionTest.php @@ -353,7 +353,6 @@ public function testClientShouldHaveDefaultVisibility(): void if (version_compare(Kernel::VERSION, '3.4', '>=')) { // Symfony made services private by default starting from 3.4 - $this->assertTrue($this->container->getDefinition('httplug.client.acme')->isPublic()); $this->assertTrue($this->container->getDefinition('httplug.client.acme')->isPrivate()); } else { // Legacy Symfony From 0c7e39ef0a94aa0f9c08349d60b58ef5595f664d Mon Sep 17 00:00:00 2001 From: David de Boer Date: Mon, 30 Nov 2020 14:45:36 +0100 Subject: [PATCH 05/27] Update to guzzle7-adapter --- composer.json | 3 +-- .../{Guzzle6Factory.php => Guzzle7Factory.php} | 8 ++++---- src/Resources/config/data-collector.xml | 4 ++-- src/Resources/config/services.xml | 2 +- tests/Functional/DiscoveryTest.php | 2 +- tests/Resources/Fixtures/config/full.php | 6 +++--- tests/Resources/Fixtures/config/full.xml | 6 +++--- tests/Resources/Fixtures/config/full.yml | 6 +++--- tests/Resources/app/config/config_test.yml | 2 +- tests/Unit/ClientFactory/Guzzle6FactoryTest.php | 8 ++++---- tests/Unit/DependencyInjection/ConfigurationTest.php | 4 ++-- tests/Unit/DependencyInjection/HttplugExtensionTest.php | 2 +- 12 files changed, 26 insertions(+), 27 deletions(-) rename src/ClientFactory/{Guzzle6Factory.php => Guzzle7Factory.php} (53%) diff --git a/composer.json b/composer.json index 099722ca..f38e7660 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,6 @@ "symfony/options-resolver": "^3.4.34 || ^4.2.12 || ^5.0" }, "conflict": { - "php-http/guzzle6-adapter": "<1.1", "php-http/curl-client": "<2.0" }, "require-dev": { @@ -50,7 +49,7 @@ "nyholm/nsa": "^1.1", "nyholm/psr7": "^1.2.1", "php-http/cache-plugin": "^1.7", - "php-http/guzzle6-adapter": "^1.1.1 || ^2.0.1", + "php-http/guzzle7-adapter": "^0.1.1", "php-http/mock-client": "^1.2", "php-http/promise": "^1.0", "polishsymfonycommunity/symfony-mocker-container": "^1.0", diff --git a/src/ClientFactory/Guzzle6Factory.php b/src/ClientFactory/Guzzle7Factory.php similarity index 53% rename from src/ClientFactory/Guzzle6Factory.php rename to src/ClientFactory/Guzzle7Factory.php index 92d9da46..6045ab03 100644 --- a/src/ClientFactory/Guzzle6Factory.php +++ b/src/ClientFactory/Guzzle7Factory.php @@ -4,20 +4,20 @@ namespace Http\HttplugBundle\ClientFactory; -use Http\Adapter\Guzzle6\Client; +use Http\Adapter\Guzzle7\Client; /** * @author Tobias Nyholm */ -class Guzzle6Factory implements ClientFactory +class Guzzle7Factory implements ClientFactory { /** * {@inheritdoc} */ public function createClient(array $config = []) { - if (!class_exists('Http\Adapter\Guzzle6\Client')) { - throw new \LogicException('To use the Guzzle6 adapter you need to install the "php-http/guzzle6-adapter" package.'); + if (!class_exists('Http\Adapter\Guzzle7\Client')) { + throw new \LogicException('To use the Guzzle7 adapter you need to install the "php-http/guzzle7-adapter" package.'); } return Client::createWithConfig($config); diff --git a/src/Resources/config/data-collector.xml b/src/Resources/config/data-collector.xml index dd3f3b85..34756793 100644 --- a/src/Resources/config/data-collector.xml +++ b/src/Resources/config/data-collector.xml @@ -66,8 +66,8 @@ - - + + diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index 67c828bf..56b25453 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -89,7 +89,7 @@ - + diff --git a/tests/Functional/DiscoveryTest.php b/tests/Functional/DiscoveryTest.php index 511aecec..a7210a02 100644 --- a/tests/Functional/DiscoveryTest.php +++ b/tests/Functional/DiscoveryTest.php @@ -4,7 +4,7 @@ namespace Http\HttplugBundle\Tests\Unit\DependencyInjection\Compiler; -use Http\Adapter\Guzzle6\Client; +use Http\Adapter\Guzzle7\Client; use Http\Client\HttpAsyncClient; use Http\Client\HttpClient; use Http\Discovery\HttpClientDiscovery; diff --git a/tests/Resources/Fixtures/config/full.php b/tests/Resources/Fixtures/config/full.php index 13c4de0f..f73b0769 100644 --- a/tests/Resources/Fixtures/config/full.php +++ b/tests/Resources/Fixtures/config/full.php @@ -11,11 +11,11 @@ 'stream_factory' => 'my_stream_factory', ], 'classes' => [ - 'client' => 'Http\Adapter\Guzzle6\Client', + 'client' => 'Http\Adapter\Guzzle7\Client', 'message_factory' => 'Http\Message\MessageFactory\GuzzleMessageFactory', 'uri_factory' => 'Http\Message\UriFactory\GuzzleUriFactory', 'stream_factory' => 'Http\Message\StreamFactory\GuzzleStreamFactory', - 'psr18_client' => 'Http\Adapter\Guzzle6\Client', + 'psr18_client' => 'Http\Adapter\Guzzle7\Client', 'psr17_request_factory' => 'Nyholm\Psr7\Factory\Psr17Factory', 'psr17_response_factory' => 'Nyholm\Psr7\Factory\Psr17Factory', 'psr17_stream_factory' => 'Nyholm\Psr7\Factory\Psr17Factory', @@ -25,7 +25,7 @@ ], 'clients' => [ 'test' => [ - 'factory' => 'httplug.factory.guzzle6', + 'factory' => 'httplug.factory.guzzle7', 'http_methods_client' => true, 'plugins' => [ 'httplug.plugin.redirect', diff --git a/tests/Resources/Fixtures/config/full.xml b/tests/Resources/Fixtures/config/full.xml index 48449964..b109dbb3 100644 --- a/tests/Resources/Fixtures/config/full.xml +++ b/tests/Resources/Fixtures/config/full.xml @@ -10,11 +10,11 @@ my_stream_factory - Http\Adapter\Guzzle6\Client + Http\Adapter\Guzzle7\Client Http\Message\MessageFactory\GuzzleMessageFactory Http\Message\UriFactory\GuzzleUriFactory Http\Message\StreamFactory\GuzzleStreamFactory - Http\Adapter\Guzzle6\Client + Http\Adapter\Guzzle7\Client Nyholm\Psr7\Factory\Psr17Factory Nyholm\Psr7\Factory\Psr17Factory Nyholm\Psr7\Factory\Psr17Factory @@ -22,7 +22,7 @@ Nyholm\Psr7\Factory\Psr17Factory Nyholm\Psr7\Factory\Psr17Factory - + httplug.plugin.redirect diff --git a/tests/Resources/Fixtures/config/full.yml b/tests/Resources/Fixtures/config/full.yml index 1190f9c9..1f4269cd 100644 --- a/tests/Resources/Fixtures/config/full.yml +++ b/tests/Resources/Fixtures/config/full.yml @@ -6,11 +6,11 @@ httplug: uri_factory: my_uri_factory stream_factory: my_stream_factory classes: - client: Http\Adapter\Guzzle6\Client + client: Http\Adapter\Guzzle7\Client message_factory: Http\Message\MessageFactory\GuzzleMessageFactory uri_factory: Http\Message\UriFactory\GuzzleUriFactory stream_factory: Http\Message\StreamFactory\GuzzleStreamFactory - psr18_client: Http\Adapter\Guzzle6\Client + psr18_client: Http\Adapter\Guzzle7\Client psr17_request_factory: Nyholm\Psr7\Factory\Psr17Factory psr17_response_factory: Nyholm\Psr7\Factory\Psr17Factory psr17_stream_factory: Nyholm\Psr7\Factory\Psr17Factory @@ -19,7 +19,7 @@ httplug: psr17_server_request_factory: Nyholm\Psr7\Factory\Psr17Factory clients: test: - factory: httplug.factory.guzzle6 + factory: httplug.factory.guzzle7 http_methods_client: true plugins: - 'httplug.plugin.redirect' diff --git a/tests/Resources/app/config/config_test.yml b/tests/Resources/app/config/config_test.yml index 3535e9de..929e5bdf 100644 --- a/tests/Resources/app/config/config_test.yml +++ b/tests/Resources/app/config/config_test.yml @@ -7,7 +7,7 @@ httplug: async_client: auto clients: acme: - factory: httplug.factory.guzzle6 + factory: httplug.factory.guzzle7 plugins: - decoder: diff --git a/tests/Unit/ClientFactory/Guzzle6FactoryTest.php b/tests/Unit/ClientFactory/Guzzle6FactoryTest.php index 51307ac3..b5c3bd22 100644 --- a/tests/Unit/ClientFactory/Guzzle6FactoryTest.php +++ b/tests/Unit/ClientFactory/Guzzle6FactoryTest.php @@ -4,14 +4,14 @@ namespace Http\HttplugBundle\Tests\Unit\ClientFactory; -use Http\Adapter\Guzzle6\Client; -use Http\HttplugBundle\ClientFactory\Guzzle6Factory; +use Http\Adapter\Guzzle7\Client; +use Http\HttplugBundle\ClientFactory\Guzzle7Factory; use PHPUnit\Framework\TestCase; /** * @author Tobias Nyholm */ -class Guzzle6FactoryTest extends TestCase +class Guzzle7FactoryTest extends TestCase { public function testCreateClient(): void { @@ -19,7 +19,7 @@ public function testCreateClient(): void $this->markTestSkipped('Guzzle6 adapter is not installed'); } - $factory = new Guzzle6Factory(); + $factory = new Guzzle7Factory(); $client = $factory->createClient(); $this->assertInstanceOf(Client::class, $client); diff --git a/tests/Unit/DependencyInjection/ConfigurationTest.php b/tests/Unit/DependencyInjection/ConfigurationTest.php index b1e3ed2f..e3b80d02 100644 --- a/tests/Unit/DependencyInjection/ConfigurationTest.php +++ b/tests/Unit/DependencyInjection/ConfigurationTest.php @@ -4,7 +4,7 @@ namespace Http\HttplugBundle\Tests\Unit\DependencyInjection; -use Http\Adapter\Guzzle6\Client; +use Http\Adapter\Guzzle7\Client; use Http\HttplugBundle\DependencyInjection\Configuration; use Http\HttplugBundle\DependencyInjection\HttplugExtension; use Http\Message\MessageFactory\GuzzleMessageFactory; @@ -158,7 +158,7 @@ public function testSupportsAllConfigFormats(): void ], 'clients' => [ 'test' => [ - 'factory' => 'httplug.factory.guzzle6', + 'factory' => 'httplug.factory.guzzle7', 'http_methods_client' => true, 'service' => null, 'public' => null, diff --git a/tests/Unit/DependencyInjection/HttplugExtensionTest.php b/tests/Unit/DependencyInjection/HttplugExtensionTest.php index 6afdec45..b9273259 100644 --- a/tests/Unit/DependencyInjection/HttplugExtensionTest.php +++ b/tests/Unit/DependencyInjection/HttplugExtensionTest.php @@ -4,7 +4,7 @@ namespace Http\HttplugBundle\Tests\Unit\DependencyInjection; -use Http\Adapter\Guzzle6\Client; +use Http\Adapter\Guzzle7\Client; use Http\Client\HttpClient; use Http\Client\Plugin\Vcr\Recorder\InMemoryRecorder; use Http\HttplugBundle\Collector\PluginClientFactoryListener; From 8e448fcd37d66faace81b3cdd154c6ac7c975be3 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Mon, 30 Nov 2020 14:51:01 +0100 Subject: [PATCH 06/27] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e178734..87a3908d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee # 1.20.0 - to be released - Support PHP 8. +- Support Guzzle 7. +- BC BREAK: Remove support for Guzzle 6. ## 1.19.0 - 2020-10-21 From 7ccaee7fed7f0774da7f6514ec17b67264e603a2 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Mon, 30 Nov 2020 16:54:37 +0100 Subject: [PATCH 07/27] Revert "Update changelog" This reverts commit 8e448fcd37d66faace81b3cdd154c6ac7c975be3. --- CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87a3908d..8e178734 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,6 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee # 1.20.0 - to be released - Support PHP 8. -- Support Guzzle 7. -- BC BREAK: Remove support for Guzzle 6. ## 1.19.0 - 2020-10-21 From 068cd2e3fe0f4ec42e7a9be1ae356f532cf5e414 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Mon, 30 Nov 2020 16:54:43 +0100 Subject: [PATCH 08/27] Revert "Update to guzzle7-adapter" This reverts commit 0c7e39ef0a94aa0f9c08349d60b58ef5595f664d. --- composer.json | 3 ++- .../{Guzzle7Factory.php => Guzzle6Factory.php} | 8 ++++---- src/Resources/config/data-collector.xml | 4 ++-- src/Resources/config/services.xml | 2 +- tests/Functional/DiscoveryTest.php | 2 +- tests/Resources/Fixtures/config/full.php | 6 +++--- tests/Resources/Fixtures/config/full.xml | 6 +++--- tests/Resources/Fixtures/config/full.yml | 6 +++--- tests/Resources/app/config/config_test.yml | 2 +- tests/Unit/ClientFactory/Guzzle6FactoryTest.php | 8 ++++---- tests/Unit/DependencyInjection/ConfigurationTest.php | 4 ++-- tests/Unit/DependencyInjection/HttplugExtensionTest.php | 2 +- 12 files changed, 27 insertions(+), 26 deletions(-) rename src/ClientFactory/{Guzzle7Factory.php => Guzzle6Factory.php} (53%) diff --git a/composer.json b/composer.json index f38e7660..099722ca 100644 --- a/composer.json +++ b/composer.json @@ -42,6 +42,7 @@ "symfony/options-resolver": "^3.4.34 || ^4.2.12 || ^5.0" }, "conflict": { + "php-http/guzzle6-adapter": "<1.1", "php-http/curl-client": "<2.0" }, "require-dev": { @@ -49,7 +50,7 @@ "nyholm/nsa": "^1.1", "nyholm/psr7": "^1.2.1", "php-http/cache-plugin": "^1.7", - "php-http/guzzle7-adapter": "^0.1.1", + "php-http/guzzle6-adapter": "^1.1.1 || ^2.0.1", "php-http/mock-client": "^1.2", "php-http/promise": "^1.0", "polishsymfonycommunity/symfony-mocker-container": "^1.0", diff --git a/src/ClientFactory/Guzzle7Factory.php b/src/ClientFactory/Guzzle6Factory.php similarity index 53% rename from src/ClientFactory/Guzzle7Factory.php rename to src/ClientFactory/Guzzle6Factory.php index 6045ab03..92d9da46 100644 --- a/src/ClientFactory/Guzzle7Factory.php +++ b/src/ClientFactory/Guzzle6Factory.php @@ -4,20 +4,20 @@ namespace Http\HttplugBundle\ClientFactory; -use Http\Adapter\Guzzle7\Client; +use Http\Adapter\Guzzle6\Client; /** * @author Tobias Nyholm */ -class Guzzle7Factory implements ClientFactory +class Guzzle6Factory implements ClientFactory { /** * {@inheritdoc} */ public function createClient(array $config = []) { - if (!class_exists('Http\Adapter\Guzzle7\Client')) { - throw new \LogicException('To use the Guzzle7 adapter you need to install the "php-http/guzzle7-adapter" package.'); + if (!class_exists('Http\Adapter\Guzzle6\Client')) { + throw new \LogicException('To use the Guzzle6 adapter you need to install the "php-http/guzzle6-adapter" package.'); } return Client::createWithConfig($config); diff --git a/src/Resources/config/data-collector.xml b/src/Resources/config/data-collector.xml index 34756793..dd3f3b85 100644 --- a/src/Resources/config/data-collector.xml +++ b/src/Resources/config/data-collector.xml @@ -66,8 +66,8 @@ - - + + diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index 56b25453..67c828bf 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -89,7 +89,7 @@ - + diff --git a/tests/Functional/DiscoveryTest.php b/tests/Functional/DiscoveryTest.php index a7210a02..511aecec 100644 --- a/tests/Functional/DiscoveryTest.php +++ b/tests/Functional/DiscoveryTest.php @@ -4,7 +4,7 @@ namespace Http\HttplugBundle\Tests\Unit\DependencyInjection\Compiler; -use Http\Adapter\Guzzle7\Client; +use Http\Adapter\Guzzle6\Client; use Http\Client\HttpAsyncClient; use Http\Client\HttpClient; use Http\Discovery\HttpClientDiscovery; diff --git a/tests/Resources/Fixtures/config/full.php b/tests/Resources/Fixtures/config/full.php index f73b0769..13c4de0f 100644 --- a/tests/Resources/Fixtures/config/full.php +++ b/tests/Resources/Fixtures/config/full.php @@ -11,11 +11,11 @@ 'stream_factory' => 'my_stream_factory', ], 'classes' => [ - 'client' => 'Http\Adapter\Guzzle7\Client', + 'client' => 'Http\Adapter\Guzzle6\Client', 'message_factory' => 'Http\Message\MessageFactory\GuzzleMessageFactory', 'uri_factory' => 'Http\Message\UriFactory\GuzzleUriFactory', 'stream_factory' => 'Http\Message\StreamFactory\GuzzleStreamFactory', - 'psr18_client' => 'Http\Adapter\Guzzle7\Client', + 'psr18_client' => 'Http\Adapter\Guzzle6\Client', 'psr17_request_factory' => 'Nyholm\Psr7\Factory\Psr17Factory', 'psr17_response_factory' => 'Nyholm\Psr7\Factory\Psr17Factory', 'psr17_stream_factory' => 'Nyholm\Psr7\Factory\Psr17Factory', @@ -25,7 +25,7 @@ ], 'clients' => [ 'test' => [ - 'factory' => 'httplug.factory.guzzle7', + 'factory' => 'httplug.factory.guzzle6', 'http_methods_client' => true, 'plugins' => [ 'httplug.plugin.redirect', diff --git a/tests/Resources/Fixtures/config/full.xml b/tests/Resources/Fixtures/config/full.xml index b109dbb3..48449964 100644 --- a/tests/Resources/Fixtures/config/full.xml +++ b/tests/Resources/Fixtures/config/full.xml @@ -10,11 +10,11 @@ my_stream_factory - Http\Adapter\Guzzle7\Client + Http\Adapter\Guzzle6\Client Http\Message\MessageFactory\GuzzleMessageFactory Http\Message\UriFactory\GuzzleUriFactory Http\Message\StreamFactory\GuzzleStreamFactory - Http\Adapter\Guzzle7\Client + Http\Adapter\Guzzle6\Client Nyholm\Psr7\Factory\Psr17Factory Nyholm\Psr7\Factory\Psr17Factory Nyholm\Psr7\Factory\Psr17Factory @@ -22,7 +22,7 @@ Nyholm\Psr7\Factory\Psr17Factory Nyholm\Psr7\Factory\Psr17Factory - + httplug.plugin.redirect diff --git a/tests/Resources/Fixtures/config/full.yml b/tests/Resources/Fixtures/config/full.yml index 1f4269cd..1190f9c9 100644 --- a/tests/Resources/Fixtures/config/full.yml +++ b/tests/Resources/Fixtures/config/full.yml @@ -6,11 +6,11 @@ httplug: uri_factory: my_uri_factory stream_factory: my_stream_factory classes: - client: Http\Adapter\Guzzle7\Client + client: Http\Adapter\Guzzle6\Client message_factory: Http\Message\MessageFactory\GuzzleMessageFactory uri_factory: Http\Message\UriFactory\GuzzleUriFactory stream_factory: Http\Message\StreamFactory\GuzzleStreamFactory - psr18_client: Http\Adapter\Guzzle7\Client + psr18_client: Http\Adapter\Guzzle6\Client psr17_request_factory: Nyholm\Psr7\Factory\Psr17Factory psr17_response_factory: Nyholm\Psr7\Factory\Psr17Factory psr17_stream_factory: Nyholm\Psr7\Factory\Psr17Factory @@ -19,7 +19,7 @@ httplug: psr17_server_request_factory: Nyholm\Psr7\Factory\Psr17Factory clients: test: - factory: httplug.factory.guzzle7 + factory: httplug.factory.guzzle6 http_methods_client: true plugins: - 'httplug.plugin.redirect' diff --git a/tests/Resources/app/config/config_test.yml b/tests/Resources/app/config/config_test.yml index 929e5bdf..3535e9de 100644 --- a/tests/Resources/app/config/config_test.yml +++ b/tests/Resources/app/config/config_test.yml @@ -7,7 +7,7 @@ httplug: async_client: auto clients: acme: - factory: httplug.factory.guzzle7 + factory: httplug.factory.guzzle6 plugins: - decoder: diff --git a/tests/Unit/ClientFactory/Guzzle6FactoryTest.php b/tests/Unit/ClientFactory/Guzzle6FactoryTest.php index b5c3bd22..51307ac3 100644 --- a/tests/Unit/ClientFactory/Guzzle6FactoryTest.php +++ b/tests/Unit/ClientFactory/Guzzle6FactoryTest.php @@ -4,14 +4,14 @@ namespace Http\HttplugBundle\Tests\Unit\ClientFactory; -use Http\Adapter\Guzzle7\Client; -use Http\HttplugBundle\ClientFactory\Guzzle7Factory; +use Http\Adapter\Guzzle6\Client; +use Http\HttplugBundle\ClientFactory\Guzzle6Factory; use PHPUnit\Framework\TestCase; /** * @author Tobias Nyholm */ -class Guzzle7FactoryTest extends TestCase +class Guzzle6FactoryTest extends TestCase { public function testCreateClient(): void { @@ -19,7 +19,7 @@ public function testCreateClient(): void $this->markTestSkipped('Guzzle6 adapter is not installed'); } - $factory = new Guzzle7Factory(); + $factory = new Guzzle6Factory(); $client = $factory->createClient(); $this->assertInstanceOf(Client::class, $client); diff --git a/tests/Unit/DependencyInjection/ConfigurationTest.php b/tests/Unit/DependencyInjection/ConfigurationTest.php index e3b80d02..b1e3ed2f 100644 --- a/tests/Unit/DependencyInjection/ConfigurationTest.php +++ b/tests/Unit/DependencyInjection/ConfigurationTest.php @@ -4,7 +4,7 @@ namespace Http\HttplugBundle\Tests\Unit\DependencyInjection; -use Http\Adapter\Guzzle7\Client; +use Http\Adapter\Guzzle6\Client; use Http\HttplugBundle\DependencyInjection\Configuration; use Http\HttplugBundle\DependencyInjection\HttplugExtension; use Http\Message\MessageFactory\GuzzleMessageFactory; @@ -158,7 +158,7 @@ public function testSupportsAllConfigFormats(): void ], 'clients' => [ 'test' => [ - 'factory' => 'httplug.factory.guzzle7', + 'factory' => 'httplug.factory.guzzle6', 'http_methods_client' => true, 'service' => null, 'public' => null, diff --git a/tests/Unit/DependencyInjection/HttplugExtensionTest.php b/tests/Unit/DependencyInjection/HttplugExtensionTest.php index b9273259..6afdec45 100644 --- a/tests/Unit/DependencyInjection/HttplugExtensionTest.php +++ b/tests/Unit/DependencyInjection/HttplugExtensionTest.php @@ -4,7 +4,7 @@ namespace Http\HttplugBundle\Tests\Unit\DependencyInjection; -use Http\Adapter\Guzzle7\Client; +use Http\Adapter\Guzzle6\Client; use Http\Client\HttpClient; use Http\Client\Plugin\Vcr\Recorder\InMemoryRecorder; use Http\HttplugBundle\Collector\PluginClientFactoryListener; From b2808bca3fb8664751274be3c02f3dcccfb1a774 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Mon, 30 Nov 2020 17:15:04 +0100 Subject: [PATCH 09/27] Support both guzzle6 and guzzle7-adapter --- composer.json | 2 +- src/ClientFactory/Guzzle7Factory.php | 25 +++++++++++++++++ src/Resources/config/data-collector.xml | 6 +++++ src/Resources/config/services.xml | 1 + tests/Functional/DiscoveryTest.php | 2 +- tests/Resources/Fixtures/config/full.php | 6 ++--- tests/Resources/Fixtures/config/full.xml | 6 ++--- tests/Resources/Fixtures/config/full.yml | 6 ++--- tests/Resources/app/config/config_test.yml | 2 +- .../Unit/ClientFactory/Guzzle7FactoryTest.php | 27 +++++++++++++++++++ tests/Unit/Collector/StackPluginTest.php | 3 +-- .../DependencyInjection/ConfigurationTest.php | 4 +-- .../HttplugExtensionTest.php | 2 +- 13 files changed, 75 insertions(+), 17 deletions(-) create mode 100644 src/ClientFactory/Guzzle7Factory.php create mode 100644 tests/Unit/ClientFactory/Guzzle7FactoryTest.php diff --git a/composer.json b/composer.json index 099722ca..6caf6543 100644 --- a/composer.json +++ b/composer.json @@ -50,7 +50,7 @@ "nyholm/nsa": "^1.1", "nyholm/psr7": "^1.2.1", "php-http/cache-plugin": "^1.7", - "php-http/guzzle6-adapter": "^1.1.1 || ^2.0.1", + "php-http/guzzle7-adapter": "^0.1.1", "php-http/mock-client": "^1.2", "php-http/promise": "^1.0", "polishsymfonycommunity/symfony-mocker-container": "^1.0", diff --git a/src/ClientFactory/Guzzle7Factory.php b/src/ClientFactory/Guzzle7Factory.php new file mode 100644 index 00000000..eafdea11 --- /dev/null +++ b/src/ClientFactory/Guzzle7Factory.php @@ -0,0 +1,25 @@ + + */ +class Guzzle7Factory implements ClientFactory +{ + /** + * {@inheritdoc} + */ + public function createClient(array $config = []) + { + if (!class_exists('Http\Adapter\Guzzle7\Client')) { + throw new \LogicException('To use the Guzzle7 adapter you need to install the "php-http/guzzle6-adapter" package.'); + } + + return Client::createWithConfig($config); + } +} diff --git a/src/Resources/config/data-collector.xml b/src/Resources/config/data-collector.xml index dd3f3b85..be607ac2 100644 --- a/src/Resources/config/data-collector.xml +++ b/src/Resources/config/data-collector.xml @@ -72,6 +72,12 @@ + + + + + + diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index 67c828bf..8cab29a2 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -90,6 +90,7 @@ + diff --git a/tests/Functional/DiscoveryTest.php b/tests/Functional/DiscoveryTest.php index 511aecec..a7210a02 100644 --- a/tests/Functional/DiscoveryTest.php +++ b/tests/Functional/DiscoveryTest.php @@ -4,7 +4,7 @@ namespace Http\HttplugBundle\Tests\Unit\DependencyInjection\Compiler; -use Http\Adapter\Guzzle6\Client; +use Http\Adapter\Guzzle7\Client; use Http\Client\HttpAsyncClient; use Http\Client\HttpClient; use Http\Discovery\HttpClientDiscovery; diff --git a/tests/Resources/Fixtures/config/full.php b/tests/Resources/Fixtures/config/full.php index 13c4de0f..f73b0769 100644 --- a/tests/Resources/Fixtures/config/full.php +++ b/tests/Resources/Fixtures/config/full.php @@ -11,11 +11,11 @@ 'stream_factory' => 'my_stream_factory', ], 'classes' => [ - 'client' => 'Http\Adapter\Guzzle6\Client', + 'client' => 'Http\Adapter\Guzzle7\Client', 'message_factory' => 'Http\Message\MessageFactory\GuzzleMessageFactory', 'uri_factory' => 'Http\Message\UriFactory\GuzzleUriFactory', 'stream_factory' => 'Http\Message\StreamFactory\GuzzleStreamFactory', - 'psr18_client' => 'Http\Adapter\Guzzle6\Client', + 'psr18_client' => 'Http\Adapter\Guzzle7\Client', 'psr17_request_factory' => 'Nyholm\Psr7\Factory\Psr17Factory', 'psr17_response_factory' => 'Nyholm\Psr7\Factory\Psr17Factory', 'psr17_stream_factory' => 'Nyholm\Psr7\Factory\Psr17Factory', @@ -25,7 +25,7 @@ ], 'clients' => [ 'test' => [ - 'factory' => 'httplug.factory.guzzle6', + 'factory' => 'httplug.factory.guzzle7', 'http_methods_client' => true, 'plugins' => [ 'httplug.plugin.redirect', diff --git a/tests/Resources/Fixtures/config/full.xml b/tests/Resources/Fixtures/config/full.xml index 48449964..b109dbb3 100644 --- a/tests/Resources/Fixtures/config/full.xml +++ b/tests/Resources/Fixtures/config/full.xml @@ -10,11 +10,11 @@ my_stream_factory - Http\Adapter\Guzzle6\Client + Http\Adapter\Guzzle7\Client Http\Message\MessageFactory\GuzzleMessageFactory Http\Message\UriFactory\GuzzleUriFactory Http\Message\StreamFactory\GuzzleStreamFactory - Http\Adapter\Guzzle6\Client + Http\Adapter\Guzzle7\Client Nyholm\Psr7\Factory\Psr17Factory Nyholm\Psr7\Factory\Psr17Factory Nyholm\Psr7\Factory\Psr17Factory @@ -22,7 +22,7 @@ Nyholm\Psr7\Factory\Psr17Factory Nyholm\Psr7\Factory\Psr17Factory - + httplug.plugin.redirect diff --git a/tests/Resources/Fixtures/config/full.yml b/tests/Resources/Fixtures/config/full.yml index 1190f9c9..1f4269cd 100644 --- a/tests/Resources/Fixtures/config/full.yml +++ b/tests/Resources/Fixtures/config/full.yml @@ -6,11 +6,11 @@ httplug: uri_factory: my_uri_factory stream_factory: my_stream_factory classes: - client: Http\Adapter\Guzzle6\Client + client: Http\Adapter\Guzzle7\Client message_factory: Http\Message\MessageFactory\GuzzleMessageFactory uri_factory: Http\Message\UriFactory\GuzzleUriFactory stream_factory: Http\Message\StreamFactory\GuzzleStreamFactory - psr18_client: Http\Adapter\Guzzle6\Client + psr18_client: Http\Adapter\Guzzle7\Client psr17_request_factory: Nyholm\Psr7\Factory\Psr17Factory psr17_response_factory: Nyholm\Psr7\Factory\Psr17Factory psr17_stream_factory: Nyholm\Psr7\Factory\Psr17Factory @@ -19,7 +19,7 @@ httplug: psr17_server_request_factory: Nyholm\Psr7\Factory\Psr17Factory clients: test: - factory: httplug.factory.guzzle6 + factory: httplug.factory.guzzle7 http_methods_client: true plugins: - 'httplug.plugin.redirect' diff --git a/tests/Resources/app/config/config_test.yml b/tests/Resources/app/config/config_test.yml index 3535e9de..929e5bdf 100644 --- a/tests/Resources/app/config/config_test.yml +++ b/tests/Resources/app/config/config_test.yml @@ -7,7 +7,7 @@ httplug: async_client: auto clients: acme: - factory: httplug.factory.guzzle6 + factory: httplug.factory.guzzle7 plugins: - decoder: diff --git a/tests/Unit/ClientFactory/Guzzle7FactoryTest.php b/tests/Unit/ClientFactory/Guzzle7FactoryTest.php new file mode 100644 index 00000000..886ba9a6 --- /dev/null +++ b/tests/Unit/ClientFactory/Guzzle7FactoryTest.php @@ -0,0 +1,27 @@ + + */ +class Guzzle7FactoryTest extends TestCase +{ + public function testCreateClient(): void + { + if (!class_exists(Client::class)) { + $this->markTestSkipped('Guzzle7 adapter is not installed'); + } + + $factory = new Guzzle7Factory(); + $client = $factory->createClient(); + + $this->assertInstanceOf(Client::class, $client); + } +} diff --git a/tests/Unit/Collector/StackPluginTest.php b/tests/Unit/Collector/StackPluginTest.php index aebad53e..d653a949 100644 --- a/tests/Unit/Collector/StackPluginTest.php +++ b/tests/Unit/Collector/StackPluginTest.php @@ -13,7 +13,6 @@ use Http\HttplugBundle\Collector\StackPlugin; use Http\Promise\FulfilledPromise; use Http\Promise\RejectedPromise; -use PHPUnit\Framework\Error\Warning; use PHPUnit\Framework\TestCase; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -179,7 +178,7 @@ public function testOnException(): void public function testOnError(): void { - $this->expectException(Warning::class); + $this->expectExceptionMessage('Division by zero'); $this->collector ->expects($this->once()) diff --git a/tests/Unit/DependencyInjection/ConfigurationTest.php b/tests/Unit/DependencyInjection/ConfigurationTest.php index b1e3ed2f..e3b80d02 100644 --- a/tests/Unit/DependencyInjection/ConfigurationTest.php +++ b/tests/Unit/DependencyInjection/ConfigurationTest.php @@ -4,7 +4,7 @@ namespace Http\HttplugBundle\Tests\Unit\DependencyInjection; -use Http\Adapter\Guzzle6\Client; +use Http\Adapter\Guzzle7\Client; use Http\HttplugBundle\DependencyInjection\Configuration; use Http\HttplugBundle\DependencyInjection\HttplugExtension; use Http\Message\MessageFactory\GuzzleMessageFactory; @@ -158,7 +158,7 @@ public function testSupportsAllConfigFormats(): void ], 'clients' => [ 'test' => [ - 'factory' => 'httplug.factory.guzzle6', + 'factory' => 'httplug.factory.guzzle7', 'http_methods_client' => true, 'service' => null, 'public' => null, diff --git a/tests/Unit/DependencyInjection/HttplugExtensionTest.php b/tests/Unit/DependencyInjection/HttplugExtensionTest.php index 6afdec45..b9273259 100644 --- a/tests/Unit/DependencyInjection/HttplugExtensionTest.php +++ b/tests/Unit/DependencyInjection/HttplugExtensionTest.php @@ -4,7 +4,7 @@ namespace Http\HttplugBundle\Tests\Unit\DependencyInjection; -use Http\Adapter\Guzzle6\Client; +use Http\Adapter\Guzzle7\Client; use Http\Client\HttpClient; use Http\Client\Plugin\Vcr\Recorder\InMemoryRecorder; use Http\HttplugBundle\Collector\PluginClientFactoryListener; From e29f2c7b109326250821b243d58762f4e5b2ccf0 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Mon, 30 Nov 2020 17:35:23 +0100 Subject: [PATCH 10/27] Handle error in PHP < 8 --- tests/Unit/Collector/StackPluginTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/Unit/Collector/StackPluginTest.php b/tests/Unit/Collector/StackPluginTest.php index d653a949..8eb443cd 100644 --- a/tests/Unit/Collector/StackPluginTest.php +++ b/tests/Unit/Collector/StackPluginTest.php @@ -13,6 +13,7 @@ use Http\HttplugBundle\Collector\StackPlugin; use Http\Promise\FulfilledPromise; use Http\Promise\RejectedPromise; +use PHPUnit\Framework\Error\Warning; use PHPUnit\Framework\TestCase; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -178,7 +179,11 @@ public function testOnException(): void public function testOnError(): void { - $this->expectExceptionMessage('Division by zero'); + if (version_compare(PHP_VERSION, '8.0.0', '>=')) { + $this->expectException(\DivisionByZeroError::class); + } else { + $this->expectException(Warning::class); + } $this->collector ->expects($this->once()) From 698e23ad547768aa05159b4421cbd34da5e06982 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Mon, 30 Nov 2020 17:39:05 +0100 Subject: [PATCH 11/27] Require PHP 7.3 --- .travis.yml | 7 +++---- composer.json | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index c761c663..e73d8c4f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,11 +22,10 @@ matrix: fast_finish: true include: # Minimum supported Symfony version and lowest PHP version - - php: 7.2 + - php: 7.3 env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak" # Test the latest stable release - - php: 7.2 - php: 7.3 env: COVERAGE=true TEST_COMMAND="composer test-ci" DEPENDENCIES="php-http/vcr-plugin:^1.0@dev" - php: 7.4 @@ -45,11 +44,11 @@ matrix: env: SYMFONY_REQUIRE=5.0.* DEPENDENCIES="symfony/http-client:^5.0" # Test with httplug 1.x clients - - php: 7.2 + - php: 7.3 env: DEPENDENCIES="php-http/buzz-adapter:^1.0 php-http/guzzle6-adapter:^1.1.1 php-http/react-adapter:^0.2.1 php-http/socket-client:^1.0" # Test with httplug 2.x clients - - php: 7.2 + - php: 7.3 env: DEPENDENCIES="php-http/guzzle6-adapter:^2.0.1 php-http/curl-client:^2.0.0 php-http/vcr-plugin:^1.0@dev" # Latest commit to master diff --git a/composer.json b/composer.json index 6caf6543..7e966194 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ } ], "require": { - "php": "^7.2 || ^8.0", + "php": "^7.3 || ^8.0", "php-http/client-common": "^1.9 || ^2.0", "php-http/client-implementation": "^1.0", "php-http/discovery": "^1.0", From fe68d499cdb2962fa288c8d6a874f8279b632f3a Mon Sep 17 00:00:00 2001 From: David de Boer Date: Wed, 2 Dec 2020 15:13:52 +0100 Subject: [PATCH 12/27] Test guzzle7-adapter only --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e73d8c4f..aa506b28 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,11 +45,11 @@ matrix: # Test with httplug 1.x clients - php: 7.3 - env: DEPENDENCIES="php-http/buzz-adapter:^1.0 php-http/guzzle6-adapter:^1.1.1 php-http/react-adapter:^0.2.1 php-http/socket-client:^1.0" + env: DEPENDENCIES="php-http/buzz-adapter:^1.0 php-http/react-adapter:^0.2.1 php-http/socket-client:^1.0" # Test with httplug 2.x clients - php: 7.3 - env: DEPENDENCIES="php-http/guzzle6-adapter:^2.0.1 php-http/curl-client:^2.0.0 php-http/vcr-plugin:^1.0@dev" + env: DEPENDENCIES="php-http/guzzle7-adapter php-http/curl-client:^2.0.0 php-http/vcr-plugin:^1.0@dev" # Latest commit to master - php: 7.4 From 032708a8d8443144b997c144f67ff10b97814288 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Tue, 15 Dec 2020 14:07:50 +0100 Subject: [PATCH 13/27] Install Guzzle adapter on demand --- .travis.yml | 5 +++-- composer.json | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index aa506b28..437d2514 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ env: - SYMFONY_PHPUNIT_VERSION="8" - SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit" - SYMFONY_DEPRECATIONS_HELPER="max[self]=0" + - DEPENDENCIES="php-http/guzzle7-adapter" branches: except: @@ -53,8 +54,8 @@ matrix: # Latest commit to master - php: 7.4 - env: STABILITY="dev" DEPENDENCIES="php-http/vcr-plugin:^1.0@dev" - - php: 8.0snapshot + env: STABILITY="dev" DEPENDENCIES="php-http/guzzle7-adapter php-http/vcr-plugin:^1.0@dev" + - php: 8.0 env: STABILITY="dev" allow_failures: diff --git a/composer.json b/composer.json index 7e966194..ce3d96e0 100644 --- a/composer.json +++ b/composer.json @@ -50,7 +50,6 @@ "nyholm/nsa": "^1.1", "nyholm/psr7": "^1.2.1", "php-http/cache-plugin": "^1.7", - "php-http/guzzle7-adapter": "^0.1.1", "php-http/mock-client": "^1.2", "php-http/promise": "^1.0", "polishsymfonycommunity/symfony-mocker-container": "^1.0", From 9736aaa3a58e0970fd95f4faf958ba103948ea95 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Tue, 15 Dec 2020 14:09:08 +0100 Subject: [PATCH 14/27] Install an adapter before running the tests --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c2151b2f..e5c21ad9 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ Please see the [official documentation](http://docs.php-http.org/en/latest/integ ## Testing ``` bash +$ composer require --dev php-http/guzzle7-adapter $ composer test ``` From a62c1049bce3a5dc6af12eb38b2282fdf574f680 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Tue, 15 Dec 2020 14:16:54 +0100 Subject: [PATCH 15/27] No snapshot --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 437d2514..e9ce888a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ matrix: - php: 7.3 env: COVERAGE=true TEST_COMMAND="composer test-ci" DEPENDENCIES="php-http/vcr-plugin:^1.0@dev" - php: 7.4 - - php: 8.0snapshot + - php: 8.0 # Test LTS versions - php: 7.3 From 5e3be8f35f9fe19980b5527de4c435e89c10027a Mon Sep 17 00:00:00 2001 From: David de Boer Date: Tue, 15 Dec 2020 14:20:40 +0100 Subject: [PATCH 16/27] Install adapter --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e9ce888a..03b586ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ matrix: # Test the latest stable release - php: 7.3 - env: COVERAGE=true TEST_COMMAND="composer test-ci" DEPENDENCIES="php-http/vcr-plugin:^1.0@dev" + env: COVERAGE=true TEST_COMMAND="composer test-ci" DEPENDENCIES="php-http/guzzle7-adapter php-http/vcr-plugin:^1.0@dev" - php: 7.4 - php: 8.0 From 1376777c7a17a6349181fd3bb0a4df454ae38757 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Tue, 15 Dec 2020 14:21:38 +0100 Subject: [PATCH 17/27] Always install psr7 lib --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index ce3d96e0..a2cf6645 100644 --- a/composer.json +++ b/composer.json @@ -46,6 +46,7 @@ "php-http/curl-client": "<2.0" }, "require-dev": { + "guzzlehttp/psr7": "^1.7", "matthiasnoback/symfony-dependency-injection-test": "^4.0", "nyholm/nsa": "^1.1", "nyholm/psr7": "^1.2.1", From 89e908b43eb78aa13ed2c4e2328bee0f7afd23ea Mon Sep 17 00:00:00 2001 From: David de Boer Date: Tue, 15 Dec 2020 14:26:57 +0100 Subject: [PATCH 18/27] Install adapter --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 03b586ba..9eb480d3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,9 +40,9 @@ matrix: - php: 7.3 env: SYMFONY_REQUIRE=4.3.* - php: 7.3 - env: SYMFONY_REQUIRE=4.4.* DEPENDENCIES="symfony/http-client:^4.4" + env: SYMFONY_REQUIRE=4.4.* DEPENDENCIES="php-http/guzzle7-adapter symfony/http-client:^4.4" - php: 7.3 - env: SYMFONY_REQUIRE=5.0.* DEPENDENCIES="symfony/http-client:^5.0" + env: SYMFONY_REQUIRE=5.0.* DEPENDENCIES="php-http/guzzle7-adapter symfony/http-client:^5.0" # Test with httplug 1.x clients - php: 7.3 From 6e33bdb8ba7dfe42a8f6029d578da4d4a23c93a7 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Tue, 15 Dec 2020 14:38:18 +0100 Subject: [PATCH 19/27] Re-add guzzle6-adapter --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9eb480d3..e152e72a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,7 +46,7 @@ matrix: # Test with httplug 1.x clients - php: 7.3 - env: DEPENDENCIES="php-http/buzz-adapter:^1.0 php-http/react-adapter:^0.2.1 php-http/socket-client:^1.0" + env: DEPENDENCIES="php-http/buzz-adapter:^1.0 php-http/guzzle6-adapter:^1.1.1 php-http/react-adapter:^0.2.1 php-http/socket-client:^1.0" # Test with httplug 2.x clients - php: 7.3 From 2439306f71083c7b95f553750d6a0229d2b01bfd Mon Sep 17 00:00:00 2001 From: David de Boer Date: Tue, 15 Dec 2020 14:39:57 +0100 Subject: [PATCH 20/27] Use guzzle6-adapter --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e152e72a..141fd4d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ matrix: include: # Minimum supported Symfony version and lowest PHP version - php: 7.3 - env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak" + env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak" DEPENDENCIES="php-http/guzzle6-adapter" # Test the latest stable release - php: 7.3 From aed21dd1e1452cd2716b56c15e8ec16cb0155dc4 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Tue, 15 Dec 2020 14:46:58 +0100 Subject: [PATCH 21/27] Try guzzle7-adapter --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 141fd4d6..6c36225b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ matrix: include: # Minimum supported Symfony version and lowest PHP version - php: 7.3 - env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak" DEPENDENCIES="php-http/guzzle6-adapter" + env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak" DEPENDENCIES="php-http/guzzle7-adapter:^0.1.1" # Test the latest stable release - php: 7.3 From 0534d1d97fa485e4727000c2386c236f2a863dd1 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Tue, 15 Dec 2020 14:56:05 +0100 Subject: [PATCH 22/27] Remove outdated fix --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6c36225b..b48e95fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -70,7 +70,6 @@ before_install: install: # To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355 - - if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then composer update --prefer-dist --no-interaction --prefer-stable --quiet; fi - COMPOSER_MEMORY_LIMIT=-1 composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction - vendor/bin/simple-phpunit install From de70519996de72f53e001cf198456cbb8d349a7b Mon Sep 17 00:00:00 2001 From: David de Boer Date: Tue, 15 Dec 2020 15:06:32 +0100 Subject: [PATCH 23/27] Fix message --- src/ClientFactory/Guzzle7Factory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ClientFactory/Guzzle7Factory.php b/src/ClientFactory/Guzzle7Factory.php index eafdea11..6045ab03 100644 --- a/src/ClientFactory/Guzzle7Factory.php +++ b/src/ClientFactory/Guzzle7Factory.php @@ -17,7 +17,7 @@ class Guzzle7Factory implements ClientFactory public function createClient(array $config = []) { if (!class_exists('Http\Adapter\Guzzle7\Client')) { - throw new \LogicException('To use the Guzzle7 adapter you need to install the "php-http/guzzle6-adapter" package.'); + throw new \LogicException('To use the Guzzle7 adapter you need to install the "php-http/guzzle7-adapter" package.'); } return Client::createWithConfig($config); From 740270e0a7941a38333a0b57a83cf1e020d35573 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Tue, 15 Dec 2020 15:20:15 +0100 Subject: [PATCH 24/27] Skip some tests --- tests/Functional/ServiceInstantiationTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/Functional/ServiceInstantiationTest.php b/tests/Functional/ServiceInstantiationTest.php index aaceefa2..9bb7d0f3 100644 --- a/tests/Functional/ServiceInstantiationTest.php +++ b/tests/Functional/ServiceInstantiationTest.php @@ -5,6 +5,7 @@ namespace Http\HttplugBundle\Tests\Functional; use GuzzleHttp\Psr7\Request as GuzzleRequest; +use Http\Adapter\Guzzle7\Client; use Http\Client\Common\Plugin\RedirectPlugin; use Http\Client\Common\PluginClient; use Http\Client\HttpClient; @@ -29,6 +30,10 @@ class ServiceInstantiationTest extends WebTestCase { public function testHttpClient(): void { + if (!class_exists(Client::class)) { + $this->markTestSkipped('Guzzle7 adapter is not installed'); + } + static::bootKernel(); $container = static::$kernel->getContainer(); $this->assertTrue($container->has('httplug.client')); @@ -38,6 +43,10 @@ public function testHttpClient(): void public function testHttpClientNoDebug(): void { + if (!class_exists(Client::class)) { + $this->markTestSkipped('Guzzle7 adapter is not installed'); + } + static::bootKernel(['debug' => false]); $container = static::$kernel->getContainer(); $this->assertTrue($container->has('httplug.client')); @@ -70,6 +79,10 @@ public function testProfilingShouldNotChangeServiceReference(): void public function testProfilingDecoration(): void { + if (!class_exists(Client::class)) { + $this->markTestSkipped('Guzzle7 adapter is not installed'); + } + static::bootKernel(['debug' => true]); $container = static::$kernel->getContainer(); From da71239dea37bfb1310c9b64ab25dbfb604e7582 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Tue, 15 Dec 2020 15:21:28 +0100 Subject: [PATCH 25/27] Skip some more tests --- tests/Unit/DependencyInjection/ConfigurationTest.php | 4 ++++ tests/Unit/DependencyInjection/HttplugExtensionTest.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/tests/Unit/DependencyInjection/ConfigurationTest.php b/tests/Unit/DependencyInjection/ConfigurationTest.php index e3b80d02..35f56953 100644 --- a/tests/Unit/DependencyInjection/ConfigurationTest.php +++ b/tests/Unit/DependencyInjection/ConfigurationTest.php @@ -128,6 +128,10 @@ public function testEmptyConfiguration(): void public function testSupportsAllConfigFormats(): void { + if (!class_exists(Client::class)) { + $this->markTestSkipped('Guzzle 7 adapter is not installed'); + } + $expectedConfiguration = [ 'default_client_autowiring' => false, 'main_alias' => [ diff --git a/tests/Unit/DependencyInjection/HttplugExtensionTest.php b/tests/Unit/DependencyInjection/HttplugExtensionTest.php index b9273259..3858010a 100644 --- a/tests/Unit/DependencyInjection/HttplugExtensionTest.php +++ b/tests/Unit/DependencyInjection/HttplugExtensionTest.php @@ -49,6 +49,10 @@ public function testConfigLoadDefault(): void public function testConfigLoadClass(): void { + if (!class_exists(Client::class)) { + $this->markTestSkipped('Guzzle 7 adapter is not installed'); + } + $this->load([ 'classes' => [ 'client' => Client::class, From bcdeed5284663c3aafada3b81d279cd18a09eeca Mon Sep 17 00:00:00 2001 From: David de Boer Date: Wed, 23 Dec 2020 14:22:33 +0100 Subject: [PATCH 26/27] Use guzzle6 for lowest --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b48e95fc..45e7fdc4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ matrix: include: # Minimum supported Symfony version and lowest PHP version - php: 7.3 - env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak" DEPENDENCIES="php-http/guzzle7-adapter:^0.1.1" + env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak" DEPENDENCIES="php-http/guzzle6-adapter" # Test the latest stable release - php: 7.3 From f196f009b24cfb830839b466be9afbd742010b5d Mon Sep 17 00:00:00 2001 From: David de Boer Date: Wed, 23 Dec 2020 14:37:38 +0100 Subject: [PATCH 27/27] Skip test --- tests/Functional/DiscoveredClientsTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/Functional/DiscoveredClientsTest.php b/tests/Functional/DiscoveredClientsTest.php index fe019960..507bd64c 100644 --- a/tests/Functional/DiscoveredClientsTest.php +++ b/tests/Functional/DiscoveredClientsTest.php @@ -4,6 +4,7 @@ namespace Http\HttplugBundle\Tests\Functional; +use Http\Adapter\Guzzle7\Client; use Http\Client\HttpAsyncClient; use Http\Client\HttpClient; use Http\Discovery\HttpAsyncClientDiscovery; @@ -101,6 +102,10 @@ public function testDisabledDiscovery(): void */ public function testForcedDiscovery(): void { + if (!class_exists(Client::class)) { + $this->markTestSkipped('Guzzle7 adapter is not installed'); + } + $container = $this->getContainer(true, 'discovery_forced'); $this->assertFalse($container->has('httplug.auto_discovery.auto_discovered_client'));