Skip to content

Commit

Permalink
[bundle] Remove any config options.
Browse files Browse the repository at this point in the history
  • Loading branch information
makasim committed Jan 18, 2018
1 parent 262142a commit 766968e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pkg/enqueue/Symfony/MissingTransportFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,16 @@ public function addConfiguration(ArrayNodeDefinition $builder)

$builder
->info($message)
->validate()->always(function () use ($message) {
throw new \InvalidArgumentException($message);
})
->beforeNormalization()
->always(function () {
return [];
})
->end()
->validate()
->always(function () use ($message) {
throw new \InvalidArgumentException($message);
})
->end()
;
}

Expand Down
17 changes: 17 additions & 0 deletions pkg/enqueue/Tests/Symfony/MissingTransportFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,21 @@ public function testThrowOnProcessForSeveralPackagesToInstall()
$this->expectExceptionMessage('Invalid configuration for path "foo": In order to use the transport "aMissingTransportName" install one of the packages "aFooPackage", "aBarPackage"');
$processor->process($tb->buildTree(), [[]]);
}

public function testThrowEvenIfThereAreSomeOptionsPassed()
{
$transport = new MissingTransportFactory('aMissingTransportName', ['aFooPackage', 'aBarPackage']);
$tb = new TreeBuilder();
$rootNode = $tb->root('foo');

$transport->addConfiguration($rootNode);
$processor = new Processor();

$this->expectException(InvalidConfigurationException::class);
$this->expectExceptionMessage('In order to use the transport "aMissingTransportName"');
$processor->process($tb->buildTree(), [[
'foo' => 'fooVal',
'bar' => 'barVal',
]]);
}
}

0 comments on commit 766968e

Please sign in to comment.