8000 bug #24706 [DependencyInjection] Add the possibility to disable asset… · symfony/symfony@e80cf9c · GitHub
[go: up one dir, main page]

Skip to content

Commit e80cf9c

Browse files
bug #24706 [DependencyInjection] Add the possibility to disable assets via xml (renatomefi)
This PR was merged into the 3.3 branch. Discussion ---------- [DependencyInjection] Add the possibility to disable assets via xml | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | no | License | MIT | Doc PR | no - When trying to disable the assets using xml configuration I realized it wasn't possible, this patch fixes and tests it - Also added extra tests since the assets being disabled was being tested on both php and yaml Extension tests Commits ------- 8579e24 [FrameworkBundle] Allow to disable assets via framework:assets xml configuration
2 parents 91d2690 + 8579e24 commit e80cf9c

File tree

5 files changed

+30
-0
lines changed

5 files changed

+30
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
<xsd:element name="package" type="package" minOccurs="0" maxOccurs="unbounded" />
139139
</xsd:sequence>
140140

141+
<xsd:attribute name="enabled" type="xsd:boolean" />
141142
<xsd:attribute name="base-path" type="xsd:string" />
142143
<xsd:attribute name="version-strategy" type="xsd:string" />
143144
<xsd:attribute name="version" type="xsd:string" />
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework', array(
4+
'assets' => array(
5+
'enabled' => false,
6+
),
7+
));
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" ?>
2+
3+
<container xmlns="http://symfony.com/schema/dic/services"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xmlns:framework="http://symfony.com/schema/dic/symfony"
6+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
7+
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
8+
9+
<framework:config>
10+
<framework:assets enabled="false" />
11+
</framework:config>
12+
</container>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
framework:
2+
assets:
3+
enabled: false

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,13 @@ public function testAssetsDefaultVersionStrategyAsService()
423423
$this->assertEquals('assets.custom_version_strategy', (string) $defaultPackage->getArgument(1));
424424
}
425425

426+
public function testAssetsCanBeDisabled()
427+
{
428+
$container = $this->createContainerFromFile('assets_disabled');
429+
430+
$this->assertFalse($container->has('templating.helper.assets'), 'The templating.helper.assets helper service is removed when assets are disabled.');
431+
}
432+
426433
public function testWebLink()
427434
{
428435
$container = $this->createContainerFromFile('web_link');

0 commit comments

Comments
 (0)
0