8000 [Messenger] Perform no deep merging of bus middleware by vudaltsov · Pull Request #34347 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Messenger] Perform no deep merging of bus middleware #34347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ CHANGELOG
* Overriding the methods `KernelTestCase::tearDown()` and `WebTestCase::tearDown()` without the `void` return-type is deprecated.
* Added new `error_controller` configuration to handle system exceptions
* Added sort option for `translation:update` command.
* [BC Break] The `framework.messenger.routing.senders` config key is not deep merged anymore.
* [BC Break] The `framework.messenger.routing.senders` config key is not deeply merged anymore.
* Added `secrets:*` commands and `%env(secret:...)%` processor to deal with secrets seamlessly.
* Made `framework.session.handler_id` accept a DSN
* Marked the `RouterDataCollector` class as `@final`.
* [BC Break] The `framework.messenger.buses.<name>.middleware` config key is not deeply merged anymore.

4.3.0
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1293,6 +1293,7 @@ function ($a) {
->defaultTrue()
->end()
->arrayNode('middleware')
->performNoDeepMerging()
->beforeNormalization()
->ifTrue(function ($v) { return \is_string($v) || (\is_array($v) && !\is_int(key($v))); })
->then(function ($v) { return [$v]; })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,64 @@ public function testItShowANiceMessageIfTwoMessengerBusesAreConfiguredButNoDefau
]);
}

public function testBusMiddlewareDontMerge()
{
$processor = new Processor();
$configuration = new Configuration(true);
$config = $processor->processConfiguration($configuration, [
[
'messenger' => [
'default_bus' => 'existing_bus',
'buses' => [
'existing_bus' => [
'middleware' => 'existing_bus.middleware',
],
'common_bus' => [
'default_middleware' => false,
'middleware' => 'common_bus.old_middleware',
],
],
],
],
[
'messenger' => [
'buses' => [
'common_bus' => [
'middleware' => 'common_bus.new_middleware',
],
'new_bus' => [
'middleware' => 'new_bus.middleware',
],
],
],
],
]);

$this->assertEquals(
[
'existing_bus' => [
'default_middleware' => true,
'middleware' => [
['id' => 'existing_bus.middleware', 'arguments' => []],
],
],
'common_bus' => [
'default_middleware' => false,
'middleware' => [
['id' => 'common_bus.new_middleware', 'arguments' => []],
],
],
'new_bus' => [
'default_middleware' => true,
'middleware' => [
['id' => 'new_bus.middleware', 'arguments' => []],
],
],
],
$config['messenger']['buses']
);
}

protected static function getBundleDefaultConfig()
{
return [
Expand Down
0