| 
11 | 11 | 
 
  | 
12 | 12 | namespace Symfony\Component\DependencyInjection\Tests\Compiler;  | 
13 | 13 | 
 
  | 
 | 14 | +use Symfony\Component\Config\Definition\Builder\TreeBuilder;  | 
 | 15 | +use Symfony\Component\Config\Definition\ConfigurationInterface;  | 
 | 16 | +use Symfony\Component\Config\Resource\FileResource;  | 
14 | 17 | use Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass;  | 
15 | 18 | use Symfony\Component\DependencyInjection\ContainerBuilder;  | 
16 | 19 | use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;  | 
@@ -48,4 +51,32 @@ public function testExpressionLanguageProviderForwarding()  | 
48 | 51 | 
 
  | 
49 | 52 |  $this->assertEquals(array($provider), $tmpProviders);  | 
50 | 53 |  }  | 
 | 54 | + | 
 | 55 | + public function testExtensionConfigurationIsTrackedByDefault()  | 
 | 56 | + {  | 
 | 57 | + $extension = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Extension\\Extension')->getMock();  | 
 | 58 | + $extension->expects($this->once())  | 
 | 59 | + ->method('getConfiguration')  | 
 | 60 | + ->will($this->returnValue(new FooConfiguration()));  | 
 | 61 | + $extension->expects($this->any())  | 
 | 62 | + ->method('getAlias')  | 
 | 63 | + ->will($this->returnValue('foo'));  | 
 | 64 | + | 
 | 65 | + $container = new ContainerBuilder(new ParameterBag());  | 
 | 66 | + $container->registerExtension($extension);  | 
 | 67 | + $container->prependExtensionConfig('foo', array('bar' => true));  | 
 | 68 | + | 
 | 69 | + $pass = new MergeExtensionConfigurationPass();  | 
 | 70 | + $pass->process($container);  | 
 | 71 | + | 
 | 72 | + $this->assertContains(new FileResource(__FILE__), $container->getResources(), '', false, false);  | 
 | 73 | + }  | 
 | 74 | +}  | 
 | 75 | + | 
 | 76 | +class FooConfiguration implements ConfigurationInterface  | 
 | 77 | +{  | 
 | 78 | + public function getConfigTreeBuilder()  | 
 | 79 | + {  | 
 | 80 | + return new TreeBuilder();  | 
 | 81 | + }  | 
51 | 82 | }  | 
0 commit comments