Skip to content

Commit

Permalink
Merge pull request #75 from knpuniversity/config-merge-fix
Browse files Browse the repository at this point in the history
fixing bug with merging config
  • Loading branch information
weaverryan authored Jan 22, 2018
2 parents 2649cf9 + f86a875 commit 8608423
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public function getConfigTreeBuilder()
$rootNode
->children()
->arrayNode('clients')
->normalizeKeys(false)
->useAttributeAsKey('variable')
->prototype('array')
->prototype('variable')->end()
->end()
Expand Down
27 changes: 27 additions & 0 deletions tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,31 @@ public function provideConfigurationTests()

return $tests;
}

public function testClientMergingConfig()
{
$fbConfig = [
'type' => 'facebook',
'client_id' => 'ABC',
'client_secret' => '123',
'graph_api_version' => '2.3',
'redirect_route' => 'my_route',
'redirect_params' => ['foo' => 'bars'],
];

$processor = new Processor();

$config = $processor->processConfiguration(
new Configuration(), [
['clients' => ['fb1' => $fbConfig]],
['clients' => ['fb2' => $fbConfig]],
]
);

// verify the client keys are merged nicely
$this->assertSame(
['fb1', 'fb2'],
array_keys($config['clients'])
);
}
}

0 comments on commit 8608423

Please sign in to comment.