Pull merge.
[yaffs-website] / vendor / symfony / http-kernel / Tests / DependencyInjection / MergeExtensionConfigurationPassTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;
13
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;
18
19 class MergeExtensionConfigurationPassTest extends TestCase
20 {
21     public function testAutoloadMainExtension()
22     {
23         $container = new ContainerBuilder();
24         $container->registerExtension(new LoadedExtension());
25         $container->registerExtension(new NotLoadedExtension());
26         $container->loadFromExtension('loaded', array());
27
28         $configPass = new MergeExtensionConfigurationPass(array('loaded', 'not_loaded'));
29         $configPass->process($container);
30
31         $this->assertTrue($container->hasDefinition('loaded.foo'));
32         $this->assertTrue($container->hasDefinition('not_loaded.bar'));
33     }
34 }
35
36 class LoadedExtension extends Extension
37 {
38     public function load(array $configs, ContainerBuilder $container)
39     {
40         $container->register('loaded.foo');
41     }
42 }
43
44 class NotLoadedExtension extends Extension
45 {
46     public function load(array $configs, ContainerBuilder $container)
47     {
48         $container->register('not_loaded.bar');
49     }
50 }