[FrameworkBundle] fix assets and templating tests

Now that the `assets` section is automatically enabled when `templating`
is enabled (see #17506), the `templating.helper.assets` will also be
present as soon as the `templating` section is activated.
This commit is contained in:
Christian Flothmann 2016-02-02 21:19:07 +01:00
parent 415bab9186
commit 293df5d610
5 changed files with 10 additions and 30 deletions

View File

@ -547,11 +547,7 @@ 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');
}
$container->getDefinition('templating.helper.assets')->replaceArgument(0, new Reference('assets.packages'));
}
}

View File

@ -1,7 +0,0 @@
<?php
$container->loadFromExtension('framework', array(
'templating' => array(
'engines' => array('php', 'twig'),
),
));

View File

@ -1,14 +0,0 @@
<?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>

View File

@ -1,3 +0,0 @@
framework:
templating:
engines: [php, twig]

View File

@ -438,7 +438,15 @@ abstract class FrameworkExtensionTest extends TestCase
public function testAssetHelperWhenTemplatesAreEnabledAndAssetsAreDisabled()
{
$container = $this->createContainerFromFile('assets_disabled');
$container = $this->createContainerFromFile('full');
$packages = $container->getDefinition('templating.helper.assets')->getArgument(0);
$this->assertSame('assets.packages', (string) $packages);
}
public function testAssetHelperWhenAssetsAndTemplatesAreDisabled()
{
$container = $this->createContainerFromFile('default_config');
$this->assertFalse($container->hasDefinition('templating.helper.assets'));
}