8000 bug #30007 [FrameworkBundle] Support use of hyphen in asset package n… · devloop42/symfony@c95fdbd · GitHub
[go: up one dir, main page]

Skip to content

Commit c95fdbd

Browse files
committed
bug symfony#30007 [FrameworkBundle] Support use of hyphen in asset package name (damaya, XuruDragon)
This PR was merged into the 3.4 branch. Discussion ---------- [FrameworkBundle] Support use of hyphen in asset package name This PR is a continuity of symfony#28128 | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#29122 | License | MIT | Doc PR | n/a According to issue symfony/symfony-docs#10442, we tested in a demo bundle, for example in src/AppBundle/Resources/config/config.yml a package using hyphens: app-client-frontend, and withouth the patch it fails because the package is not recognized. With the patch, it works as expected. ```yaml framework:     assets:         packages:             app-client-frontend:                 version: "%env(FRONTEND_VERSION)%"                 version_format: '%%2$s/dist/%%1$s'                 base_urls:                   - "%env(FRONTEND_URL)%" ``` Commits ------- 5c58b6e Add PackageNameTest to ConfigurationTest also add in the changelog the corresponding entry to this PR 30b6a4f Support use of hyphen in asset package name
2 parents f797a78 + 5c58b6e commit c95fdbd

File tree

2 files changed

+30
-0
lines changed
8000

2 files changed

+30
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,7 @@ private function addAssetsSection(ArrayNodeDefinition $rootNode)
642642
->fixXmlConfig('package')
643643
->children()
644644
->arrayNode('packages')
645+
->normalizeKeys(false)
645646
->useAttributeAsKey('name')
646647
->prototype('array')
647648
->fixXmlConfig('base_url')

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,35 @@ publ 8000 ic function testAssetsCanBeEnabled()
211211
$this->assertEquals($defaultConfig, $config['assets']);
212212
}
213213

214+
/**
215+
* @dataProvider provideValidAssetsPackageNameConfigurationTests
216+
*/
217+
public function testValidAssetsPackageNameConfiguration($packageName)
218+
{
219+
$processor = new Processor();
220+
$configuration = new Configuration(true);
221+
$config = $processor->processConfiguration($configuration, [
222+
[
223+
'assets' => [
224+
'packages' => [
225+
$packageName => [],
226+
],
227+
],
228+
],
229+
]);
230+
231+
$this->assertArrayHasKey($packageName, $config['assets']['packages']);
232+
}
233+
234+
public function provideValidAssetsPackageNameConfigurationTests()
235+
{
236+
return [
237+
['foobar'],
238+
['foo-bar'],
239+
['foo_bar'],
240+
];
241+
}
242+
214243
/**
215244
* @dataProvider provideInvalidAssetConfigurationTests
216245
*/

0 commit comments

Comments
 (0)
0