8000 [Asset] Version as service by ewgRa · Pull Request #17532 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Asset] Version as service #17532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cs and texts
  • Loading branch information
ewgRa committed Jan 26, 2016
commit b270a798ddc868e7515adf4e3eaff39c945b1ae4
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ private function addAssetsSection(ArrayNodeDefinition $rootNode)
->ifTrue(function ($v) {
return (null !== $v['version_strategy'] && null !== $v['version']);
})
->thenInvalid('You cannot use version_strategy and version settings in assets configuration.')
->thenInvalid('You cannot use both "version_strategy" and "version" at the same time under "assets".')
->end()
->fixXmlConfig('package')
->children()
Expand All @@ -407,7 +407,7 @@ private function addAssetsSection(ArrayNodeDefinition $rootNode)
->ifTrue(function ($v) {
return (null !== $v['version_strategy'] && null !== $v['version']);
})
->thenInvalid('You cannot use version_strategy and version settings in same package.')
->thenInvalid('You cannot use both "version_strategy" and "version" at the same time under "assets" for the "%s" package.')
->end()
->end()
->end()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ private function registerAssetsConfiguration(array $config, ContainerBuilder $co
foreach ($config['packages'] as $name => $package) {
if (null !== $package['version_strategy']) {
$version = new Reference($package['version_strategy']);
} else if (null === $package['version']) {
} elseif (null === $package['version']) {
$version = $defaultVersion;
} else {
$format = $package['version_format'] ?: $config['version_format'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public function testInvalidValueTrustedProxies()
{
$processor = new Processor();
$configuration = new Configuration(true);

$processor->processConfiguration($configuration, array(
array(
'secret' => 's3cr3t',
Expand Down Expand Up @@ -119,46 +120,47 @@ public function testAssetsCanBeEnabled()

/**
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
* @expectedExceptionMessage You cannot use version_strategy and version settings in assets configuration.
* @expectedExceptionMessage You cannot use both "version_strategy" and "version" at the same time under "assets".
*/
public function testInvalidVersionStrategy()
{
$processor = new Processor();
$configuration = new Configuration(true);
$processor->processConfiguration($configuration, array(
array(
'assets' => array(
'base_urls' => '//example.com',
'version' => 1,
'version_strategy' => 'foo',
),
array(
'assets' => array(
'base_urls' => '//example.com',
'version' => 1,
'version_strategy' => 'foo',
),
));
),
));
}

/**
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
* @expectedExceptionMessage You cannot use version_strategy and version settings in same package.
* @expectedExceptionMessage You cannot use both "version_strategy" and "version" at the same time under "assets" for the "{"base_urls":["\/\/example.com"],"version":1,"version_strategy":"foo","version_format":null,"base_path":""}" package.
*/
public function testInvalidPackageVersionStrategy()
{
$processor = new Processor();
$configuration = new Configuration(true);

$processor->processConfiguration($configuration, array(
array(
'assets' => array(
'base_urls' => '//example.com',
'version' => 1,
'packages' => array(
'foo' => array(
'base_urls' => '//example.com',
'version' => 1,
'version_strategy' => 'foo',
),
array(
'assets' => array(
'base_urls' => '//example.com',
'version' => 1,
'packages' => array(
'foo' => array(
'base_urls' => '//example.com',
'version' => 1,
'version_strategy' => 'foo',
),
),
),
));
),
));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above


protected static function getBundleDefaultConfig()
Expand Down
0