Skip to content

Commit d97ab72

Browse files
Merge branch '5.2' into 5.x
* 5.2: [PhpUnitBridge] CS fix [Notifier] Only use sprintf instead of sprintf and string concat [PhpUnitBridge] Fix PHP 5.5 compatibility Fix exception thrown by Form when converting UUID [Notifier] Remove trailing argument in tests [Serializer] Make fabbot happy with 5.2 tests CS Add missing param annotation abouts $fileLinkFormat [HttpClient] Use decoration instead of class replacement for mock factory [Form] Fixed StringUtil::trim() to trim ZERO WIDTH SPACE (U+200B) and SOFT HYPHEN (U+00AD) 23412 Stop treating multiline resources as globs
2 parents 0f5466a + 2cb5031 commit d97ab72

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2072,8 +2072,8 @@ private function registerHttpClientConfiguration(array $config, ContainerBuilder
20722072
}
20732073

20742074
if ($responseFactoryId = $config['mock_response_factory'] ?? null) {
2075-
$container->getDefinition($httpClientId)
2076-
->setClass(MockHttpClient::class)
2075+
$container->register($httpClientId.'.mock_client', MockHttpClient::class)
2076+
->setDecoratedService($httpClientId, null, -10) // lower priority than TraceableHttpClient
20772077
->setArguments([new Reference($responseFactoryId)]);
20782078
}
20792079
}

Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1629,14 +1629,15 @@ public function testHttpClientMockResponseFactory()
16291629
{
16301630
$container = $this->createContainerFromFile('http_client_mock_response_factory');
16311631

1632-
$definition = $container->getDefinition('http_client');
1632+
$definition = $container->getDefinition('http_client.mock_client');
16331633

16341634
$this->assertSame(MockHttpClient::class, $definition->getClass());
16351635
$this->assertCount(1, $definition->getArguments());
16361636

16371637
$argument = $definition->getArgument(0);
16381638

16391639
$this->assertInstanceOf(Reference::class, $argument);
1640+
$this->assertSame('http_client', current($definition->getDecoratedService()));
16401641
$this->assertSame('my_response_factory', (string) $argument);
16411642
}
16421643

0 commit comments

Comments
 (0)