bug #14419 inject asset packages in assets helper service (xabbuh)
This PR was merged into the 2.7 branch.
Discussion
----------
inject asset packages in assets helper service
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #14368
| License | MIT
| Doc PR |
Commits
-------
6928507
inject asset packages in assets helper service
This commit is contained in:
commit
b66a713fed
@ -558,6 +558,12 @@ class FrameworkExtension extends Extension
|
||||
'Symfony\\Bundle\\FrameworkBundle\\Templating\\Loader\\FilesystemLoader',
|
||||
));
|
||||
}
|
||||
|
||||
if ($container->hasDefinition('assets.packages')) {
|
||||
$container->getDefinition('templating.helper.assets')->replaceArgument(0, new Reference('assets.packages'));
|
||||
} else {
|
||||
$container->removeDefinition('templating.helper.assets');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$container->loadFromExtension('framework', array(
|
||||
'templating' => array(
|
||||
'engines' => array('php', 'twig'),
|
||||
),
|
||||
));
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" ?>
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:framework="http://symfony.com/schema/dic/symfony"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
|
||||
|
||||
<framework:config>
|
||||
<framework:templating>
|
||||
<framework:engine>php</framework:engine>
|
||||
<framework:engine>twig</framework:engine>
|
||||
</framework:templating>
|
||||
</framework:config>
|
||||
</container>
|
@ -0,0 +1,3 @@
|
||||
framework:
|
||||
templating:
|
||||
engines: [php, twig]
|
@ -445,6 +445,22 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||
$this->assertTrue($container->has('serializer'));
|
||||
}
|
||||
|
||||
public function testAssetHelperWhenAssetsAreEnabled()
|
||||
{
|
||||
$container = $this->createContainerFromFile('full');
|
||||
$packages = $container->getDefinition('templating.helper.assets')->getArgument(0);
|
||||
|
||||
$this->assertSame('assets.packages', (string) $packages);
|
||||
}
|
||||
|
||||
public function testAssetHelperWhenTemplatesAreEnabledAndAssetsAreDisabled()
|
||||
{
|
||||
$container = $this->createContainerFromFile('assets_disabled');
|
||||
$packages = $container->getDefinition('templating.helper.assets')->getArgument(0);
|
||||
|
||||
$this->assertSame('assets.packages', (string) $packages);
|
||||
}
|
||||
|
||||
protected function createContainer(array $data = array())
|
||||
{
|
||||
return new ContainerBuilder(new ParameterBag(array_merge(array(
|
||||
|
Reference in New Issue
Block a user