diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Bar.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Bar.php
index 83f2da12a7..1aaca2f156 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Bar.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Bar.php
@@ -13,8 +13,11 @@ namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
class Bar implements BarInterface
{
+ public $quz;
+
public function __construct($quz = null, \NonExistent $nonExistent = null, BarInterface $decorated = null, array $foo = [])
{
+ $this->quz = $quz;
}
public static function create(\NonExistent $nonExistent = null, $factory = null)
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/defaults_bindings.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/defaults_bindings.xml
new file mode 100644
index 0000000000..d943dfad2d
--- /dev/null
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/defaults_bindings.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ value
+
+ value
+
+
+
+
+
+
+
+
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/defaults_bindings2.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/defaults_bindings2.xml
new file mode 100644
index 0000000000..db41330f85
--- /dev/null
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/defaults_bindings2.xml
@@ -0,0 +1,10 @@
+
+
+
+
+ overridden
+
+
+
+
+
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/defaults_bindings.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/defaults_bindings.yml
index 2e054f563d..ca5e5048de 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/defaults_bindings.yml
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/defaults_bindings.yml
@@ -8,4 +8,4 @@ services:
class: Symfony\Component\DependencyInjection\Tests\Fixtures\Bar
foo:
- class: Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummy
+ class: stdClass
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/defaults_bindings2.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/defaults_bindings2.yml
index 75e9834526..01fc5af624 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/defaults_bindings2.yml
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/defaults_bindings2.yml
@@ -1,7 +1,7 @@
services:
_defaults:
bind:
- $quz: ~
+ $quz: overridden
bar:
class: Symfony\Component\DependencyInjection\Tests\Fixtures\Bar
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
index d89887acca..03376a641d 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
@@ -17,6 +17,7 @@ use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Config\Resource\GlobResource;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
+use Symfony\Component\DependencyInjection\Compiler\ResolveBindingsPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
@@ -820,4 +821,20 @@ class XmlFileLoaderTest extends TestCase
$dump = $dumper->dump();
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services_tsantos.php', $dumper->dump());
}
+
+ /**
+ * The pass may throw an exception, which will cause the test to fail.
+ */
+ public function testOverriddenDefaultsBindings()
+ {
+ $container = new ContainerBuilder();
+
+ $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
+ $loader->load('defaults_bindings.xml');
+ $loader->load('defaults_bindings2.xml');
+
+ (new ResolveBindingsPass())->process($container);
+
+ $this->assertSame('overridden', $container->get('bar')->quz);
+ }
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
index 001fa33e59..05521bf784 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
@@ -747,6 +747,6 @@ class YamlFileLoaderTest extends TestCase
(new ResolveBindingsPass())->process($container);
- $this->assertTrue(true);
+ $this->assertSame('overridden', $container->get('bar')->quz);
}
}