Skip to content

Commit 4ba0e0d

Browse files
kriswallsmithfabpot
authored andcommitted
[AsseticBundle] fixed bundle notation of inputs
1 parent c01be42 commit 4ba0e0d

File tree

7 files changed

+33
-9
lines changed

7 files changed

+33
-9
lines changed

src/Symfony/Bundle/AsseticBundle/Factory/AssetFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ public function __construct(Kernel $kernel, $baseDir, $debug = false)
3030
parent::__construct($baseDir, $debug);
3131
}
3232

33-
protected function parseAsset($sourceUrl)
33+
protected function parseInput($input)
3434
{
3535
// expand bundle notation
36-
if ('@' == $sourceUrl[0] && false !== strpos($sourceUrl, '/')) {
37-
$sourceUrl = $this->kernel->locateResource($sourceUrl);
36+
if ('@' == $input[0] && false !== strpos($input, '/')) {
37+
$input = $this->kernel->locateResource($input);
3838
}
3939

40-
return parent::parseAsset($sourceUrl);
40+
return parent::parseInput($input);
4141
}
4242
}

src/Symfony/Bundle/AsseticBundle/Tests/FunctionalTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function testTwigRenderDebug()
8585
$content = $container->get('templating')->render('::layout.html.twig');
8686
$crawler = new Crawler($content);
8787

88-
$this->assertEquals(2, count($crawler->filter('link[href$=".css"]')));
88+
$this->assertEquals(3, count($crawler->filter('link[href$=".css"]')));
8989
$this->assertEquals(2, count($crawler->filter('script[src$=".js"]')));
9090
}
9191

@@ -103,14 +103,14 @@ public function testPhpRenderDebug()
103103
$content = $container->get('templating')->render('::layout.html.php');
104104
$crawler = new Crawler($content);
105105

106-
$this->assertEquals(2, count($crawler->filter('link[href$=".css"]')));
106+
$this->assertEquals(3, count($crawler->filter('link[href$=".css"]')));
107107
$this->assertEquals(2, count($crawler->filter('script[src$=".js"]')));
108108
}
109109

110110
public function provideDebugAndAssetCount()
111111
{
112112
return array(
113-
array(true, 4),
113+
array(true, 5),
114114
array(false, 2),
115115
);
116116
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony framework.
5+
*
6+
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
7+
*
8+
* This source file is subject to the MIT license that is bundled
9+
* with this source code in the file LICENSE.
10+
*/
11+
12+
namespace Symfony\Bundle\AsseticBundle\Tests\Kernel;
13+
14+
use Symfony\Component\HttpKernel\Bundle\Bundle;
15+
16+
class TestBundle extends Bundle
17+
{
18+
public function getPath()
19+
{
20+
return parent::getPath().'/bundle';
21+
}
22+
}

src/Symfony/Bundle/AsseticBundle/Tests/Kernel/TestKernel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function registerBundles()
2727
new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
2828
new \Symfony\Bundle\TwigBundle\TwigBundle(),
2929
new \Symfony\Bundle\AsseticBundle\AsseticBundle(),
30+
new TestBundle(),
3031
);
3132
}
3233

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* bundle.css */

src/Symfony/Bundle/AsseticBundle/Tests/Kernel/views/layout.html.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php $view->extend('::base.html.php') ?>
22

33
<?php $view['slots']->start('stylesheets') ?>
4-
<?php foreach($view['assetic']->stylesheets('stylesheet1.css, stylesheet2.css') as $url): ?>
4+
<?php foreach($view['assetic']->stylesheets('stylesheet1.css, stylesheet2.css, @TestBundle/Resources/css/bundle.css') as $url): ?>
55
<link href="<?php echo $view->escape($url) ?>" type="text/css" rel="stylesheet" />
66
<?php endforeach; ?>
77
<?php $view['slots']->stop() ?>

src/Symfony/Bundle/AsseticBundle/Tests/Kernel/views/layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% extends '::base.html.twig' %}
22

33
{% block stylesheets %}
4-
{% stylesheets 'stylesheet1.css' 'stylesheet2.css' %}
4+
{% stylesheets 'stylesheet1.css' 'stylesheet2.css' '@TestBundle/Resources/css/bundle.css' %}
55
<link href="{{ asset_url }}" type="text/css" rel="stylesheet" />
66
{% endstylesheets %}
77
{% endblock %}

0 commit comments

Comments
 (0)