Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 766968e

Browse files
committed
[bundle] Remove any config options.
1 parent 262142a commit 766968e

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

pkg/enqueue/Symfony/MissingTransportFactory.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,16 @@ public function addConfiguration(ArrayNodeDefinition $builder)
4747

4848
$builder
4949
->info($message)
50-
->validate()->always(function () use ($message) {
51-
throw new \InvalidArgumentException($message);
52-
})
50+
->beforeNormalization()
51+
->always(function () {
52+
return [];
53+
})
54+
->end()
55+
->validate()
56+
->always(function () use ($message) {
57+
throw new \InvalidArgumentException($message);
58+
})
59+
->end()
5360
;
5461
}
5562

pkg/enqueue/Tests/Symfony/MissingTransportFactoryTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,21 @@ public function testThrowOnProcessForSeveralPackagesToInstall()
5353
$this->expectExceptionMessage('Invalid configuration for path "foo": In order to use the transport "aMissingTransportName" install one of the packages "aFooPackage", "aBarPackage"');
5454
$processor->process($tb->buildTree(), [[]]);
5555
}
56+
57+
public function testThrowEvenIfThereAreSomeOptionsPassed()
58+
{
59+
$transport = new MissingTransportFactory('aMissingTransportName', ['aFooPackage', 'aBarPackage']);
60+
$tb = new TreeBuilder();
61+
$rootNode = $tb->root('foo');
62+
63+
$transport->addConfiguration($rootNode);
64+
$processor = new Processor();
65+
66+
$this->expectException(InvalidConfigurationException::class);
67+
$this->expectExceptionMessage('In order to use the transport "aMissingTransportName"');
68+
$processor->process($tb->buildTree(), [[
69+
'foo' => 'fooVal',
70+
'bar' => 'barVal',
71+
]]);
72+
}
5673
}

0 commit comments

Comments
 (0)