Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refactor GlobalVariables ... and add test

  • Loading branch information...
commit c4a5aad364a27ad95c018c096b989299a36ba418 1 parent a287cc0
@rande rande authored
View
3  DependencyInjection/SonataBlockExtension.php
@@ -62,8 +62,7 @@ public function load(array $configs, ContainerBuilder $container)
}
}
- $container->getDefinition('sonata.block.twig.global')
- ->replaceArgument(1, $config['templates']);
+ $container->getDefinition('sonata.block.twig.global')->replaceArgument(0, $config['templates']);
}
/**
View
1  Resources/config/core.xml
@@ -54,7 +54,6 @@
</service>
<service id="sonata.block.twig.global" class="Sonata\BlockBundle\Twig\GlobalVariables" >
- <argument type="service" id="service_container" />
<argument />
</service>
View
16 Tests/Twig/GlobalVariablesTest.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Sonata\BlockBundle\Twig\Extension;
+
+use Sonata\BlockBundle\Twig\GlobalVariables;
+
+class GlobalVariablesTest extends \PHPUnit_Framework_TestCase
+{
+
+ public function testGlobalVariables()
+ {
+ $variables = new GlobalVariables(array());
+
+ $this->assertEmpty($variables->getTemplates());
+ }
+}
View
8 Twig/GlobalVariables.php
@@ -11,8 +11,6 @@
namespace Sonata\BlockBundle\Twig;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-
/**
* GlobalVariables
*
@@ -20,18 +18,14 @@
*/
class GlobalVariables
{
- protected $container;
-
protected $templates;
/**
*
- * @param ContainerInterface $container
* @param array $templates
*/
- public function __construct(ContainerInterface $container, array $templates)
+ public function __construct(array $templates)
{
- $this->container = $container;
$this->templates = $templates;
}
Please sign in to comment.
Something went wrong with that request. Please try again.