Added the Search API Synonym module to deal specifically with licence and license...
[yaffs-website] / vendor / symfony / dependency-injection / Tests / Extension / ExtensionTest.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\DependencyInjection\Tests\Extension;
13
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\DependencyInjection\ContainerBuilder;
16 use Symfony\Component\DependencyInjection\Extension\Extension;
17
18 class ExtensionTest extends TestCase
19 {
20     /**
21      * @dataProvider getResolvedEnabledFixtures
22      */
23     public function testIsConfigEnabledReturnsTheResolvedValue($enabled)
24     {
25         $extension = new EnableableExtension();
26         $this->assertSame($enabled, $extension->isConfigEnabled(new ContainerBuilder(), array('enabled' => $enabled)));
27     }
28
29     public function getResolvedEnabledFixtures()
30     {
31         return array(
32             array(true),
33             array(false),
34         );
35     }
36
37     /**
38      * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
39      * @expectedExceptionMessage The config array has no 'enabled' key.
40      */
41     public function testIsConfigEnabledOnNonEnableableConfig()
42     {
43         $extension = new EnableableExtension();
44
45         $extension->isConfigEnabled(new ContainerBuilder(), array());
46     }
47 }
48
49 class EnableableExtension extends Extension
50 {
51     public function load(array $configs, ContainerBuilder $container)
52     {
53     }
54
55     public function isConfigEnabled(ContainerBuilder $container, array $config)
56     {
57         return parent::isConfigEnabled($container, $config);
58     }
59 }