From 3378f5e9a1aa17b13f6655d4f099d20dde33222f Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 19 Mar 2019 22:30:37 +0100 Subject: [PATCH] fix max host connections option for XML configs --- .../Resources/config/schema/symfony-1.0.xsd | 1 + .../Fixtures/php/http_client_override_default_options.php | 2 ++ .../Fixtures/xml/http_client_override_default_options.xml | 4 ++-- .../Fixtures/yml/http_client_override_default_options.yml | 2 ++ .../Tests/DependencyInjection/FrameworkExtensionTest.php | 8 +++++--- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd index c1242a1e08..98baeb978b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd @@ -486,6 +486,7 @@ + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/http_client_override_default_options.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/http_client_override_default_options.php index 5482f2903e..26b76359da 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/http_client_override_default_options.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/http_client_override_default_options.php @@ -2,11 +2,13 @@ $container->loadFromExtension('framework', [ 'http_client' => [ + 'max_host_connections' => 4, 'default_options' => [ 'headers' => ['foo' => 'bar'], ], 'clients' => [ 'foo' => [ + 'max_host_connections' => 5, 'default_options' => [ 'headers' => ['bar' => 'baz'], ], diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/http_client_override_default_options.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/http_client_override_default_options.xml index 33c201ef9f..085b4721cc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/http_client_override_default_options.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/http_client_override_default_options.xml @@ -6,11 +6,11 @@ http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> - + bar - + baz diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/http_client_override_default_options.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/http_client_override_default_options.yml index 3751644172..9a3d69e358 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/http_client_override_default_options.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/http_client_override_default_options.yml @@ -1,8 +1,10 @@ framework: http_client: + max_host_connections: 4 default_options: headers: {'foo': 'bar'} clients: foo: + max_host_connections: 5 default_options: headers: {'bar': 'baz'} diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 0e6eff1e10..5c0352b265 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -1389,15 +1389,17 @@ abstract class FrameworkExtensionTest extends TestCase { $container = $this->createContainerFromFile('http_client_override_default_options'); - $this->assertSame(['foo' => ['bar']], $container->getDefinition('http_client')->getArguments()[0]['headers']); - $this->assertSame(['bar' => ['baz'], 'foo' => ['bar']], $container->getDefinition('foo')->getArguments()[0]['headers']); + $this->assertSame(['foo' => ['bar']], $container->getDefinition('http_client')->getArgument(0)['headers']); + $this->assertSame(4, $container->getDefinition('http_client')->getArgument(1)); + $this->assertSame(['bar' => ['baz'], 'foo' => ['bar']], $container->getDefinition('foo')->getArgument(0)['headers']); + $this->assertSame(5, $container->getDefinition('foo')->getArgument(1)); } public function testHttpClientFullDefaultOptions() { $container = $this->createContainerFromFile('http_client_full_default_options'); - $defaultOptions = $container->getDefinition('http_client')->getArguments()[0]; + $defaultOptions = $container->getDefinition('http_client')->getArgument(0); $this->assertSame('foo:bar', $defaultOptions['auth_basic']); $this->assertSame(['foo' => 'bar', 'bar' => 'baz'], $defaultOptions['query']);