vendor/symfony/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/ConfigurationTest.php
changeset 0 7f95f8617b0b
equal deleted inserted replaced
-1:000000000000 0:7f95f8617b0b
       
     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\Bundle\SecurityBundle\Tests\DependencyInjection;
       
    13 
       
    14 use Symfony\Bundle\SecurityBundle\DependencyInjection\MainConfiguration;
       
    15 use Symfony\Component\Config\Definition\Processor;
       
    16 
       
    17 class ConfigurationTest extends \PHPUnit_Framework_TestCase
       
    18 {
       
    19     /**
       
    20      * The minimal, required config needed to not have any required validation
       
    21      * issues.
       
    22      *
       
    23      * @var array
       
    24      */
       
    25     protected static $minimalConfig = array(
       
    26         'providers' => array(
       
    27             'stub' => array(),
       
    28         ),
       
    29         'firewalls' => array(
       
    30             'stub' => array(),
       
    31         ),
       
    32     );
       
    33 
       
    34     /**
       
    35      * Test that the main tree is OK to be passed a factory or factories
       
    36      * key, without throwing any validation errors.
       
    37      */
       
    38     public function testMainConfigTreeWithFactories()
       
    39     {
       
    40         $config = array_merge(self::$minimalConfig, array(
       
    41             'factory'   => array('foo' => 'bar'),
       
    42             'factories' => array('lorem' => 'ipsum'),
       
    43         ));
       
    44 
       
    45         $processor = new Processor();
       
    46         $configuration = new MainConfiguration(array());
       
    47         $config = $processor->processConfiguration($configuration, array($config));
       
    48 
       
    49         $this->assertFalse(array_key_exists('factory', $config), 'The factory key is silently removed without an exception');
       
    50         $this->assertEquals(array(), $config['factories'], 'The factories key is just an empty array');
       
    51     }
       
    52 }