8000 [DependencyInjection] Add the possibility to disable assets via xml · symfony/symfony@df5822e · GitHub
[go: up one dir, main page]

Skip to content

Commit df5822e

Browse files
committed
[DependencyInjection] Add the possibility to disable assets via xml
1 parent beee423 commit df5822e

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
@@ -139,6 +139,7 @@
139139
<xsd:element name="package" type="package" minOccurs="0" maxOccurs="unbounded" />
140140
</xsd:sequence>
141141

142+
<xsd:attribute name="enabled" type="xsd:boolean" />
142143
<xsd:attribute name="base-path" type="xsd:string" />
143144
<xsd:attribute name="version-strategy" type="xsd:string" />
144145
<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
@@ -452,6 +452,13 @@ public function testAssetsDefaultVersionStrategyAsService()
452452
$this->assertEquals('assets.custom_version_strategy', (string) $defaultPackage->getArgument(1));
453453
}
454454

455+
public function testAssetsCanBeDisabled()
456+
{
457+
$container = $this->createContainerFromFile('assets_disabled');
458+
459+
$this->assertFalse($container->has('templating.helper.assets'), 'The templating.helper.assets helper service is removed when assets are disabled.');
460+
}
461+
455462
public function testWebLink()
456463
{
457464
$container = $this->createContainerFromFile('web_link');

0 commit comments

Comments
 (0)
0