Skip to content

Commit dd08726

Browse files
committed
multi client configuration
1 parent f8f5150 commit dd08726

File tree

2 files changed

+10
-96
lines changed

2 files changed

+10
-96
lines changed

DependencyInjection/Configuration.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,6 @@ public function getConfigTreeBuilder(): TreeBuilder
2424
{
2525
$tb = new TreeBuilder();
2626
$rootNode = $tb->root('enqueue');
27-
$rootNode
28-
->beforeNormalization()
29-
->always(function ($value) {
30-
if (empty($value)) {
31-
return [
32-
'default' => [
33-
'transport' => [
34-
'dsn' => 'null:',
35-
],
36-
],
37-
];
38-
}
39-
40-
if (is_string($value)) {
41-
return [
42-
'default' => [
43-
'transport' => [
44-
'dsn' => $value,
45-
],
46-
],
47-
];
48-
}
49-
50-
return $value;
51-
})
52-
;
5327

5428
$rootNode
5529
->requiresAtLeastOneElement()

Tests/Unit/DependencyInjection/ConfigurationTest.php

Lines changed: 10 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -28,48 +28,6 @@ public function testCouldBeConstructedWithDebugAsArgument()
2828
new Configuration(true);
2929
}
3030

31-
public function testShouldProcessNullAsDefaultNullTransport()
32-
{
33-
$configuration = new Configuration(true);
34-
35-
$processor = new Processor();
36-
$config = $processor->processConfiguration($configuration, [null]);
37-
38-
$this->assertConfigEquals([
39-
'default' => [
40-
'transport' => ['dsn' => 'null:'],
41-
],
42-
], $config);
43-
}
44-
45-
public function testShouldProcessStringAsDefaultDsnTransport()
46-
{
47-
$configuration = new Configuration(true);
48-
49-
$processor = new Processor();
50-
$config = $processor->processConfiguration($configuration, ['foo://bar?option=val']);
51-
52-
$this->assertConfigEquals([
53-
'default' => [
54-
'transport' => ['dsn' => 'foo://bar?option=val'],
55-
],
56-
], $config);
57-
}
58-
59-
public function testShouldProcessEmptyArrayAsDefaultNullTransport()
60-
{
61-
$configuration = new Configuration(true);
62-
63-
$processor = new Processor();
64-
$config = $processor->processConfiguration($configuration, [[]]);
65-
66-
$this->assertConfigEquals([
67-
'default' => [
68-
'transport' => ['dsn' => 'null:'],
69-
],
70-
], $config);
71-
}
72-
7331
public function testShouldProcessSeveralTransports()
7432
{
7533
$configuration = new Configuration(true);
@@ -118,32 +76,6 @@ public function testTransportFactoryShouldValidateEachTransportAccordingToItsRul
11876
]);
11977
}
12078

121-
public function testShouldUseDefaultConfigurationIfNothingIsConfiguredAtAll()
122-
{
123-
$configuration = new Configuration(true);
124-
125-
$processor = new Processor();
126-
$config = $processor->processConfiguration($configuration, [[]]);
127-
128-
$this->assertEquals([
129-
'default' => [
130-
'transport' => ['dsn' => 'null:'],
131-
'consumption' => [
132-
'receive_timeout' => 10000,
133-
],
134-
// 'job' => false,
135-
// 'async_events' => ['enabled' => false],
136-
'async_commands' => ['enabled' => false],
137-
'extensions' => [
138-
'doctrine_ping_connection_extension' => false,
139-
'doctrine_clear_identity_map_extension' => false,
140-
'signal_extension' => function_exists('pcntl_signal_dispatch'),
141-
'reply_extension' => true,
142-
],
143-
],
144-
], $config);
145-
}
146-
14779
public function testShouldSetDefaultConfigurationForClient()
14880
{
14981
$configuration = new Configuration(true);
@@ -264,7 +196,11 @@ public function testDoctrinePingConnectionExtensionShouldBeDisabledByDefault()
264196
$configuration = new Configuration(true);
265197

266198
$processor = new Processor();
267-
$config = $processor->processConfiguration($configuration, [[]]);
199+
$config = $processor->processConfiguration($configuration, [[
200+
'default' => [
201+
'transport' => null,
202+
]
203+
]]);
268204

269205
$this->assertArraySubset([
270206
'default' => [
@@ -303,7 +239,11 @@ public function testDoctrineClearIdentityMapExtensionShouldBeDisabledByDefault()
303239
$configuration = new Configuration(true);
304240

305241
$processor = new Processor();
306-
$config = $processor->processConfiguration($configuration, [[]]);
242+
$config = $processor->processConfiguration($configuration, [[
243+
'default' => [
244+
'transport' => null,
245+
]
246+
]]);
307247

308248
$this->assertArraySubset([
309249
'default' => [

0 commit comments

Comments
 (0)