diff --git a/CHANGELOG.md b/CHANGELOG.md index 43434250..9383bb95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release. +# Version 2 + +# 2.0.0 - (unreleased) +- Fixed a deprecation when creating a `HttpMethodsClient` via `http_methods_client: true`. Only PSR-17 factories are now passed as constructor arguments. +- Changed the default stream factory argument for the cache plugin. This now requires a PSR-17 StreamFactoryInterface instance. +- Creating a client using the `BuzzFactory` no longer accepts `verify_peer` and `verify_host` config options. Only a boolean `verify` flag is accepted, covering both previous options. +- Removed support of deprecated PHP-HTTP factories, only PSR-17 factories are now supported and used. +- Removed `message_factory`, `uri_factory`, and `stream_factory` classes config option. You can configure your own factories via psr17_*_factory classes config +- Removed support for guzzle5-adapter + # Version 1 # 1.31.0 - 2023-11-06 diff --git a/composer.json b/composer.json index 2a7a03d4..9f1993b7 100644 --- a/composer.json +++ b/composer.json @@ -26,14 +26,14 @@ ], "require": { "php": "^7.3 || ^8.0", - "php-http/client-common": "^1.9 || ^2.0", + "php-http/client-common": "^2.0", "php-http/client-implementation": "^1.0", "php-http/discovery": "^1.14", "php-http/httplug": "^2.0", "php-http/logger-plugin": "^1.1", "php-http/message": "^1.9", - "php-http/message-factory": "^1.0.2", "php-http/stopwatch-plugin": "^1.2", + "psr/http-factory-implementation": "^1.0", "psr/http-message": "^1.0 || ^2.0", "symfony/config": "^4.4 || ^5.0 || ^6.0", "symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0", @@ -44,7 +44,10 @@ "conflict": { "php-http/guzzle6-adapter": "<1.1", "php-http/curl-client": "<2.0", - "php-http/socket-client": "<2.0" + "php-http/socket-client": "<2.0", + "kriswallsmith/buzz": "<0.17", + "php-http/react-adapter": "<3.0", + "php-http/cache-plugin": "<1.7" }, "require-dev": { "guzzlehttp/psr7": "^1.7 || ^2.0", diff --git a/src/ClientFactory/BuzzFactory.php b/src/ClientFactory/BuzzFactory.php index 1a0f148d..2b964536 100644 --- a/src/ClientFactory/BuzzFactory.php +++ b/src/ClientFactory/BuzzFactory.php @@ -5,8 +5,7 @@ namespace Http\HttplugBundle\ClientFactory; use Buzz\Client\FileGetContents; -use Http\Adapter\Buzz\Client as Adapter; -use Http\Message\MessageFactory; +use Psr\Http\Message\ResponseFactoryInterface; use Symfony\Component\OptionsResolver\OptionsResolver; /** @@ -15,13 +14,13 @@ class BuzzFactory implements ClientFactory { /** - * @var MessageFactory + * @var ResponseFactoryInterface */ - private $messageFactory; + private $responseFactory; - public function __construct(MessageFactory $messageFactory) + public function __construct(ResponseFactoryInterface $responseFactory) { - $this->messageFactory = $messageFactory; + $this->responseFactory = $responseFactory; } /** @@ -29,19 +28,11 @@ public function __construct(MessageFactory $messageFactory) */ public function createClient(array $config = []) { - if (!class_exists('Http\Adapter\Buzz\Client')) { - throw new \LogicException('To use the Buzz adapter you need to install the "php-http/buzz-adapter" package.'); + if (!class_exists('Buzz\Client\FileGetContents')) { + throw new \LogicException('To use the Buzz you need to install the "kriswallsmith/buzz" package.'); } - $client = new FileGetContents(); - $options = $this->getOptions($config); - - $client->setTimeout($options['timeout']); - $client->setVerifyPeer($options['verify_peer']); - $client->setVerifyHost($options['verify_host']); - $client->setProxy($options['proxy']); - - return new Adapter($client, $this->messageFactory); + return new FileGetContents($this->responseFactory, $this->getOptions($config)); } /** @@ -53,14 +44,12 @@ private function getOptions(array $config = []) $resolver->setDefaults([ 'timeout' => 5, - 'verify_peer' => true, - 'verify_host' => 2, + 'verify' => true, 'proxy' => null, ]); $resolver->setAllowedTypes('timeout', 'int'); - $resolver->setAllowedTypes('verify_peer', 'bool'); - $resolver->setAllowedTypes('verify_host', 'int'); + $resolver->setAllowedTypes('verify', 'bool'); $resolver->setAllowedTypes('proxy', ['string', 'null']); return $resolver->resolve($config); diff --git a/src/ClientFactory/Guzzle5Factory.php b/src/ClientFactory/Guzzle5Factory.php deleted file mode 100644 index 38eb6d28..00000000 --- a/src/ClientFactory/Guzzle5Factory.php +++ /dev/null @@ -1,39 +0,0 @@ - - */ -class Guzzle5Factory implements ClientFactory -{ - /** - * @var MessageFactory - */ - private $messageFactory; - - public function __construct(MessageFactory $messageFactory) - { - $this->messageFactory = $messageFactory; - } - - /** - * {@inheritdoc} - */ - public function createClient(array $config = []) - { - if (!class_exists('Http\Adapter\Guzzle5\Client')) { - throw new \LogicException('To use the Guzzle5 adapter you need to install the "php-http/guzzle5-adapter" package.'); - } - - $client = new Client($config); - - return new Adapter($client, $this->messageFactory); - } -} diff --git a/src/ClientFactory/ReactFactory.php b/src/ClientFactory/ReactFactory.php index 489467ca..b0d34718 100644 --- a/src/ClientFactory/ReactFactory.php +++ b/src/ClientFactory/ReactFactory.php @@ -5,23 +5,12 @@ namespace Http\HttplugBundle\ClientFactory; use Http\Adapter\React\Client; -use Http\Message\MessageFactory; /** * @author Tobias Nyholm */ class ReactFactory implements ClientFactory { - /** - * @var MessageFactory - */ - private $messageFactory; - - public function __construct(MessageFactory $messageFactory) - { - $this->messageFactory = $messageFactory; - } - /** * {@inheritdoc} */ @@ -31,6 +20,6 @@ public function createClient(array $config = []) throw new \LogicException('To use the React adapter you need to install the "php-http/react-adapter" package.'); } - return new Client($this->messageFactory); + return new Client(); } } diff --git a/src/ClientFactory/SocketFactory.php b/src/ClientFactory/SocketFactory.php index 7407f6fb..610399f1 100644 --- a/src/ClientFactory/SocketFactory.php +++ b/src/ClientFactory/SocketFactory.php @@ -5,23 +5,12 @@ namespace Http\HttplugBundle\ClientFactory; use Http\Client\Socket\Client; -use Http\Message\MessageFactory; /** * @author Tobias Nyholm */ class SocketFactory implements ClientFactory { - /** - * @var MessageFactory - */ - private $messageFactory; - - public function __construct(MessageFactory $messageFactory) - { - $this->messageFactory = $messageFactory; - } - /** * {@inheritdoc} */ diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 12ec833d..33337e72 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -66,9 +66,10 @@ public function getConfigTreeBuilder(): TreeBuilder ->validate() ->ifTrue(function ($v) { return !empty($v['classes']['client']) - || !empty($v['classes']['message_factory']) - || !empty($v['classes']['uri_factory']) - || !empty($v['classes']['stream_factory']); + || !empty($v['classes']['psr17_request_factory']) + || !empty($v['classes']['psr17_response_factory']) + || !empty($v['classes']['psr17_uri_factory']) + || !empty($v['classes']['psr17_stream_factory']); }) ->then(function ($v) { foreach ($v['classes'] as $key => $class) { @@ -119,9 +120,6 @@ public function getConfigTreeBuilder(): TreeBuilder ->children() ->scalarNode('client')->defaultValue('httplug.client.default')->end() ->scalarNode('psr18_client')->defaultValue('httplug.psr18_client.default')->end() - ->scalarNode('message_factory')->defaultValue('httplug.message_factory.default')->end() - ->scalarNode('uri_factory')->defaultValue('httplug.uri_factory.default')->end() - ->scalarNode('stream_factory')->defaultValue('httplug.stream_factory.default')->end() ->scalarNode('psr17_request_factory')->defaultValue('httplug.psr17_request_factory.default')->end() ->scalarNode('psr17_response_factory')->defaultValue('httplug.psr17_response_factory.default')->end() ->scalarNode('psr17_stream_factory')->defaultValue('httplug.psr17_stream_factory.default')->end() @@ -136,9 +134,6 @@ public function getConfigTreeBuilder(): TreeBuilder ->children() ->scalarNode('client')->defaultNull()->end() ->scalarNode('psr18_client')->defaultNull()->end() - ->scalarNode('message_factory')->defaultNull()->end() - ->scalarNode('uri_factory')->defaultNull()->end() - ->scalarNode('stream_factory')->defaultNull()->end() ->scalarNode('psr17_request_factory')->defaultNull()->end() ->scalarNode('psr17_response_factory')->defaultNull()->end() ->scalarNode('psr17_stream_factory')->defaultNull()->end() @@ -857,7 +852,7 @@ private function createCachePluginNode(): NodeDefinition ->end() ->scalarNode('stream_factory') ->info('This must be a service id to a service implementing '.StreamFactory::class) - ->defaultValue('httplug.stream_factory') + ->defaultValue('httplug.psr17_stream_factory') ->cannotBeEmpty() ->end() ->end() diff --git a/src/DependencyInjection/HttplugExtension.php b/src/DependencyInjection/HttplugExtension.php index a70e0b6c..c37e8213 100644 --- a/src/DependencyInjection/HttplugExtension.php +++ b/src/DependencyInjection/HttplugExtension.php @@ -486,7 +486,7 @@ function ($id) { if ($arguments['http_methods_client']) { $container ->register($serviceId.'.http_methods', HttpMethodsClient::class) - ->setArguments([new Reference($serviceId.'.http_methods.inner'), new Reference('httplug.message_factory')]) + ->setArguments([new Reference($serviceId.'.http_methods.inner'), new Reference('httplug.psr17_request_factory'), new Reference('httplug.psr17_stream_factory')]) ->setPublic($arguments['public'] ? true : false) ->setDecoratedService($serviceId) ; @@ -513,7 +513,7 @@ private function createUri(ContainerBuilder $container, $serviceId, $uri): void $container ->register($serviceId, UriInterface::class) ->setPublic(false) - ->setFactory([new Reference('httplug.uri_factory'), 'createUri']) + ->setFactory([new Reference('httplug.psr17_uri_factory'), 'createUri']) ->addArgument($uri) ; } diff --git a/src/Resources/config/data-collector.xml b/src/Resources/config/data-collector.xml index 9b50490c..c34e41bc 100644 --- a/src/Resources/config/data-collector.xml +++ b/src/Resources/config/data-collector.xml @@ -63,12 +63,6 @@ - - - - - - diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index c8e9ed04..a0fe256b 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -22,23 +22,6 @@ - - - - - - - - - - - - - - - - - @@ -80,23 +63,16 @@ - + - - - - - - - - - + + diff --git a/tests/Functional/DiscoveredClientsTest.php b/tests/Functional/DiscoveredClientsTest.php index b5c05c8d..e4d3300a 100644 --- a/tests/Functional/DiscoveredClientsTest.php +++ b/tests/Functional/DiscoveredClientsTest.php @@ -10,6 +10,7 @@ use Http\Discovery\HttpAsyncClientDiscovery; use Http\Discovery\HttpClientDiscovery; use Http\Discovery\Strategy\CommonClassesStrategy; +use Http\Discovery\Strategy\CommonPsr17ClassesStrategy; use Http\HttplugBundle\Collector\ProfileClient; use Http\HttplugBundle\Discovery\ConfiguredClientsStrategyListener; use Nyholm\NSA; @@ -131,7 +132,7 @@ protected function setUp(): void // Reset values $strategy = new ConfiguredClientsStrategyListener(null, null); - HttpClientDiscovery::setStrategies([CommonClassesStrategy::class]); + HttpClientDiscovery::setStrategies([CommonClassesStrategy::class, CommonPsr17ClassesStrategy::class]); $strategy->onEvent(); } } diff --git a/tests/Functional/DiscoveryTest.php b/tests/Functional/DiscoveryTest.php index a7210a02..d21d7410 100644 --- a/tests/Functional/DiscoveryTest.php +++ b/tests/Functional/DiscoveryTest.php @@ -9,12 +9,13 @@ use Http\Client\HttpClient; use Http\Discovery\HttpClientDiscovery; use Http\HttplugBundle\DependencyInjection\HttplugExtension; -use Http\Message\MessageFactory; -use Http\Message\StreamFactory; -use Http\Message\UriFactory; use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase; use Matthias\SymfonyDependencyInjectionTest\PhpUnit\ContainerBuilderHasAliasConstraint; use PHPUnit\Framework\Constraint\LogicalNot; +use Psr\Http\Message\RequestFactoryInterface; +use Psr\Http\Message\ResponseFactoryInterface; +use Psr\Http\Message\StreamFactoryInterface; +use Psr\Http\Message\UriFactoryInterface; use Symfony\Component\DependencyInjection\Definition; /** @@ -44,9 +45,10 @@ public function testDiscoveryFallbacks(): void $this->load(); $this->assertContainerBuilderHasService('httplug.client.default', HttpClient::class); - $this->assertContainerBuilderHasService('httplug.message_factory.default', MessageFactory::class); - $this->assertContainerBuilderHasService('httplug.uri_factory.default', UriFactory::class); - $this->assertContainerBuilderHasService('httplug.stream_factory.default', StreamFactory::class); + $this->assertContainerBuilderHasService('httplug.psr17_request_factory.default', RequestFactoryInterface::class); + $this->assertContainerBuilderHasService('httplug.psr17_response_factory.default', ResponseFactoryInterface::class); + $this->assertContainerBuilderHasService('httplug.psr17_uri_factory.default', UriFactoryInterface::class); + $this->assertContainerBuilderHasService('httplug.psr17_stream_factory.default', StreamFactoryInterface::class); $this->assertContainerBuilderHasService('httplug.async_client.default', HttpAsyncClient::class); } @@ -56,18 +58,19 @@ public function testDiscoveryPartialFallbacks(): void $this->setDefinition('httplug.client.default', new Definition(Client::class)); $this->assertContainerBuilderHasService('httplug.client.default', Client::class); - $this->assertContainerBuilderHasService('httplug.message_factory.default', MessageFactory::class); - $this->assertContainerBuilderHasService('httplug.uri_factory.default', UriFactory::class); - $this->assertContainerBuilderHasService('httplug.stream_factory.default', StreamFactory::class); + $this->assertContainerBuilderHasService('httplug.psr17_request_factory.default', RequestFactoryInterface::class); + $this->assertContainerBuilderHasService('httplug.psr17_response_factory.default', ResponseFactoryInterface::class); + $this->assertContainerBuilderHasService('httplug.psr17_uri_factory.default', UriFactoryInterface::class); + $this->assertContainerBuilderHasService('httplug.psr17_stream_factory.default', StreamFactoryInterface::class); $this->assertContainerBuilderHasService('httplug.async_client.default', HttpAsyncClient::class); } public function testNoDiscoveryFallbacks(): void { $this->setDefinition('httplug.client.default', new Definition(HttpClient::class)); - $this->setDefinition('httplug.message_factory.default', new Definition(MessageFactory::class)); - $this->setDefinition('httplug.uri_factory.default', new Definition(UriFactory::class)); - $this->setDefinition('httplug.stream_factory.default', new Definition(StreamFactory::class)); + $this->setDefinition('httplug.psr17_request_factory.default', new Definition(RequestFactoryInterface::class)); + $this->setDefinition('httplug.psr17_uri_factory.default', new Definition(UriFactoryInterface::class)); + $this->setDefinition('httplug.psr17_stream_factory.default', new Definition(StreamFactoryInterface::class)); $this->setDefinition('httplug.async_client.default', new Definition(HttpAsyncClient::class)); $this->load(); diff --git a/tests/Resources/Fixtures/config/full.php b/tests/Resources/Fixtures/config/full.php index 1ad5ff88..78b2c6d3 100644 --- a/tests/Resources/Fixtures/config/full.php +++ b/tests/Resources/Fixtures/config/full.php @@ -6,15 +6,13 @@ 'default_client_autowiring' => false, 'main_alias' => [ 'client' => 'my_client', - 'message_factory' => 'my_message_factory', - 'uri_factory' => 'my_uri_factory', - 'stream_factory' => 'my_stream_factory', + 'psr17_request_factory' => 'my_psr17_request_factory', + 'psr17_response_factory' => 'my_psr17_response_factory', + 'psr17_uri_factory' => 'my_psr17_uri_factory', + 'psr17_stream_factory' => 'my_psr17_stream_factory', ], 'classes' => [ '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\Guzzle7\Client', 'psr17_request_factory' => 'Nyholm\Psr7\Factory\Psr17Factory', 'psr17_response_factory' => 'Nyholm\Psr7\Factory\Psr17Factory', diff --git a/tests/Resources/Fixtures/config/full.xml b/tests/Resources/Fixtures/config/full.xml index 2e4f3f22..d47867d7 100644 --- a/tests/Resources/Fixtures/config/full.xml +++ b/tests/Resources/Fixtures/config/full.xml @@ -5,15 +5,13 @@ false my_client - my_message_factory - my_uri_factory - my_stream_factory + my_psr17_request_factory + my_psr17_response_factory + my_psr17_uri_factory + my_psr17_stream_factory Http\Adapter\Guzzle7\Client - Http\Message\MessageFactory\GuzzleMessageFactory - Http\Message\UriFactory\GuzzleUriFactory - Http\Message\StreamFactory\GuzzleStreamFactory Http\Adapter\Guzzle7\Client Nyholm\Psr7\Factory\Psr17Factory Nyholm\Psr7\Factory\Psr17Factory diff --git a/tests/Resources/Fixtures/config/full.yml b/tests/Resources/Fixtures/config/full.yml index a0c41421..7e054599 100644 --- a/tests/Resources/Fixtures/config/full.yml +++ b/tests/Resources/Fixtures/config/full.yml @@ -2,14 +2,12 @@ httplug: default_client_autowiring: false main_alias: client: my_client - message_factory: my_message_factory - uri_factory: my_uri_factory - stream_factory: my_stream_factory + psr17_request_factory: my_psr17_request_factory + psr17_response_factory: my_psr17_response_factory + psr17_uri_factory: my_psr17_uri_factory + psr17_stream_factory: my_psr17_stream_factory classes: 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\Guzzle7\Client psr17_request_factory: Nyholm\Psr7\Factory\Psr17Factory psr17_response_factory: Nyholm\Psr7\Factory\Psr17Factory diff --git a/tests/Resources/app/AppKernel.php b/tests/Resources/app/AppKernel.php index 5475b827..1ccf56e7 100644 --- a/tests/Resources/app/AppKernel.php +++ b/tests/Resources/app/AppKernel.php @@ -108,9 +108,6 @@ public function process(ContainerBuilder $container): void 'httplug.strategy', 'httplug.auto_discovery.auto_discovered_client', 'httplug.auto_discovery.auto_discovered_async', - 'httplug.message_factory.default', - 'httplug.stream_factory.default', - 'httplug.uri_factory.default', 'httplug.async_client.default', 'httplug.client.default', 'app.http.plugin.custom', diff --git a/tests/Unit/ClientFactory/BuzzFactoryTest.php b/tests/Unit/ClientFactory/BuzzFactoryTest.php index f1f4020c..f5b54489 100644 --- a/tests/Unit/ClientFactory/BuzzFactoryTest.php +++ b/tests/Unit/ClientFactory/BuzzFactoryTest.php @@ -4,10 +4,10 @@ namespace Http\HttplugBundle\Tests\Unit\ClientFactory; -use Http\Adapter\Buzz\Client; +use Buzz\Client\FileGetContents; use Http\HttplugBundle\ClientFactory\BuzzFactory; -use Http\Message\MessageFactory; use PHPUnit\Framework\TestCase; +use Psr\Http\Message\ResponseFactoryInterface; /** * @author Tobias Nyholm @@ -16,13 +16,13 @@ class BuzzFactoryTest extends TestCase { public function testCreateClient(): void { - if (!class_exists(Client::class)) { - $this->markTestSkipped('Buzz adapter is not installed'); + if (!class_exists(FileGetContents::class)) { + $this->markTestSkipped('Buzz client is not installed'); } - $factory = new BuzzFactory($this->getMockBuilder(MessageFactory::class)->getMock()); + $factory = new BuzzFactory($this->getMockBuilder(ResponseFactoryInterface::class)->getMock()); $client = $factory->createClient(); - $this->assertInstanceOf(Client::class, $client); + $this->assertInstanceOf(FileGetContents::class, $client); } } diff --git a/tests/Unit/ClientFactory/ReactFactoryTest.php b/tests/Unit/ClientFactory/ReactFactoryTest.php index c31783b3..eb09e049 100644 --- a/tests/Unit/ClientFactory/ReactFactoryTest.php +++ b/tests/Unit/ClientFactory/ReactFactoryTest.php @@ -6,7 +6,6 @@ use Http\Adapter\React\Client; use Http\HttplugBundle\ClientFactory\ReactFactory; -use Http\Message\MessageFactory; use PHPUnit\Framework\TestCase; /** @@ -20,7 +19,7 @@ public function testCreateClient(): void $this->markTestSkipped('React adapter is not installed'); } - $factory = new ReactFactory($this->getMockBuilder(MessageFactory::class)->getMock()); + $factory = new ReactFactory(); $client = $factory->createClient(); $this->assertInstanceOf(Client::class, $client); diff --git a/tests/Unit/ClientFactory/SocketFactoryTest.php b/tests/Unit/ClientFactory/SocketFactoryTest.php index 71e8cdc4..8ea380d5 100644 --- a/tests/Unit/ClientFactory/SocketFactoryTest.php +++ b/tests/Unit/ClientFactory/SocketFactoryTest.php @@ -6,7 +6,6 @@ use Http\Client\Socket\Client; use Http\HttplugBundle\ClientFactory\SocketFactory; -use Http\Message\MessageFactory; use PHPUnit\Framework\TestCase; /** @@ -20,7 +19,7 @@ public function testCreateClient(): void $this->markTestSkipped('Socket client is not installed'); } - $factory = new SocketFactory($this->getMockBuilder(MessageFactory::class)->getMock()); + $factory = new SocketFactory(); $client = $factory->createClient(); $this->assertInstanceOf(Client::class, $client); diff --git a/tests/Unit/DependencyInjection/ConfigurationTest.php b/tests/Unit/DependencyInjection/ConfigurationTest.php index a1f648ab..1f8baee0 100644 --- a/tests/Unit/DependencyInjection/ConfigurationTest.php +++ b/tests/Unit/DependencyInjection/ConfigurationTest.php @@ -7,9 +7,6 @@ use Http\Adapter\Guzzle7\Client; use Http\HttplugBundle\DependencyInjection\Configuration; use Http\HttplugBundle\DependencyInjection\HttplugExtension; -use Http\Message\MessageFactory\GuzzleMessageFactory; -use Http\Message\StreamFactory\GuzzleStreamFactory; -use Http\Message\UriFactory\GuzzleUriFactory; use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionConfigurationTestCase; use Nyholm\Psr7\Factory\Psr17Factory; use Symfony\Component\Config\Definition\ConfigurationInterface; @@ -25,9 +22,6 @@ class ConfigurationTest extends AbstractExtensionConfigurationTestCase 'default_client_autowiring' => true, 'main_alias' => [ 'client' => 'httplug.client.default', - 'message_factory' => 'httplug.message_factory.default', - 'uri_factory' => 'httplug.uri_factory.default', - 'stream_factory' => 'httplug.stream_factory.default', 'psr18_client' => 'httplug.psr18_client.default', 'psr17_request_factory' => 'httplug.psr17_request_factory.default', 'psr17_response_factory' => 'httplug.psr17_response_factory.default', @@ -39,9 +33,6 @@ class ConfigurationTest extends AbstractExtensionConfigurationTestCase 'classes' => [ 'client' => null, 'psr18_client' => null, - 'message_factory' => null, - 'uri_factory' => null, - 'stream_factory' => null, 'psr17_request_factory' => null, 'psr17_response_factory' => null, 'psr17_stream_factory' => null, @@ -59,7 +50,7 @@ class ConfigurationTest extends AbstractExtensionConfigurationTestCase 'authentication' => [], 'cache' => [ 'enabled' => false, - 'stream_factory' => 'httplug.stream_factory', + 'stream_factory' => 'httplug.psr17_stream_factory', 'config' => [ 'methods' => ['GET', 'HEAD'], 'blacklisted_paths' => [], @@ -125,22 +116,16 @@ public function testSupportsAllConfigFormats(): void 'default_client_autowiring' => false, 'main_alias' => [ 'client' => 'my_client', - 'message_factory' => 'my_message_factory', - 'uri_factory' => 'my_uri_factory', - 'stream_factory' => 'my_stream_factory', 'psr18_client' => 'httplug.psr18_client.default', - 'psr17_request_factory' => 'httplug.psr17_request_factory.default', - 'psr17_response_factory' => 'httplug.psr17_response_factory.default', - 'psr17_stream_factory' => 'httplug.psr17_stream_factory.default', - 'psr17_uri_factory' => 'httplug.psr17_uri_factory.default', + 'psr17_request_factory' => 'my_psr17_request_factory', + 'psr17_response_factory' => 'my_psr17_response_factory', + 'psr17_stream_factory' => 'my_psr17_stream_factory', + 'psr17_uri_factory' => 'my_psr17_uri_factory', 'psr17_uploaded_file_factory' => 'httplug.psr17_uploaded_file_factory.default', 'psr17_server_request_factory' => 'httplug.psr17_server_request_factory.default', ], 'classes' => [ 'client' => Client::class, - 'message_factory' => GuzzleMessageFactory::class, - 'uri_factory' => GuzzleUriFactory::class, - 'stream_factory' => GuzzleStreamFactory::class, 'psr18_client' => Client::class, 'psr17_request_factory' => Psr17Factory::class, 'psr17_response_factory' => Psr17Factory::class, @@ -492,7 +477,7 @@ public function testNullDefaultTtl(): void ], 'cache_pool' => 'my_custom_cache_pull', 'enabled' => true, - 'stream_factory' => 'httplug.stream_factory', + 'stream_factory' => 'httplug.psr17_stream_factory', ], ], ], diff --git a/tests/Unit/DependencyInjection/HttplugExtensionTest.php b/tests/Unit/DependencyInjection/HttplugExtensionTest.php index 3b65c540..6f5a3696 100644 --- a/tests/Unit/DependencyInjection/HttplugExtensionTest.php +++ b/tests/Unit/DependencyInjection/HttplugExtensionTest.php @@ -41,7 +41,7 @@ public function testConfigLoadDefault(): void { $this->load(); - foreach (['client', 'message_factory', 'uri_factory', 'stream_factory'] as $type) { + foreach (['client', 'psr17_request_factory', 'psr17_response_factory', 'psr17_uri_factory', 'psr17_stream_factory'] as $type) { $this->assertContainerBuilderHasAlias("httplug.$type", "httplug.$type.default"); } } @@ -66,13 +66,14 @@ public function testConfigLoadService(): void $this->load([ 'main_alias' => [ 'client' => 'my_client_service', - 'message_factory' => 'my_message_factory_service', - 'uri_factory' => 'my_uri_factory_service', - 'stream_factory' => 'my_stream_factory_service', + 'psr17_request_factory' => 'my_psr17_request_factory_service', + 'psr17_response_factory' => 'my_psr17_response_factory_service', + 'psr17_uri_factory' => 'my_psr17_uri_factory_service', + 'psr17_stream_factory' => 'my_psr17_stream_factory_service', ], ]); - foreach (['client', 'message_factory', 'uri_factory', 'stream_factory'] as $type) { + foreach (['client', 'psr17_request_factory', 'psr17_response_factory', 'psr17_uri_factory', 'psr17_stream_factory'] as $type) { $this->assertContainerBuilderHasAlias("httplug.$type", "my_{$type}_service"); } }