4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\DependencyInjection\ContainerBuilder;
16 use Symfony\Component\HttpKernel\DependencyInjection\Extension;
17 use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass;
19 class MergeExtensionConfigurationPassTest extends TestCase
21 public function testAutoloadMainExtension()
23 $container = new ContainerBuilder();
24 $container->registerExtension(new LoadedExtension());
25 $container->registerExtension(new NotLoadedExtension());
26 $container->loadFromExtension('loaded', array());
28 $configPass = new MergeExtensionConfigurationPass(array('loaded', 'not_loaded'));
29 $configPass->process($container);
31 $this->assertTrue($container->hasDefinition('loaded.foo'));
32 $this->assertTrue($container->hasDefinition('not_loaded.bar'));
36 class LoadedExtension extends Extension
38 public function load(array $configs, ContainerBuilder $container)
40 $container->register('loaded.foo');
44 class NotLoadedExtension extends Extension
46 public function load(array $configs, ContainerBuilder $container)
48 $container->register('not_loaded.bar');