Вход Регистрация
Файл: symfony-2.7/src/Symfony/Bundle/DebugBundle/Tests/DependencyInjection/DebugExtensionTest.php
Строк: 116
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace SymfonyBundleDebugBundleTestsDependencyInjection;

use 
SymfonyBundleDebugBundleDependencyInjectionDebugExtension;
use 
SymfonyComponentDependencyInjectionContainerBuilder;
use 
SymfonyComponentDependencyInjectionParameterBagParameterBag;

class 
DebugExtensionTest extends PHPUnit_Framework_TestCase
{
    public function 
testLoadWithoutConfiguration()
    {
        
$container $this->createContainer();
        
$container->registerExtension(new DebugExtension());
        
$container->loadFromExtension('debug', array());
        
$this->compileContainer($container);

        
$expectedTags = array(
            array(
                
"id" => "dump",
                
"template" => "@Debug/Profiler/dump.html.twig",
            ),
        );

        
$this->assertSame($expectedTags$container->getDefinition('data_collector.dump')->getTag('data_collector'));
    }

    private function 
createContainer()
    {
        
$container = new ContainerBuilder(new ParameterBag(array(
            
'kernel.cache_dir' => __DIR__,
            
'kernel.root_dir' => __DIR__.'/Fixtures',
            
'kernel.charset' => 'UTF-8',
            
'kernel.debug' => true,
            
'kernel.bundles' => array('DebugBundle' => 'Symfony\Bundle\DebugBundle\DebugBundle'),
        )));

        return 
$container;
    }

    private function 
compileContainer(ContainerBuilder $container)
    {
        
$container->getCompilerPassConfig()->setOptimizationPasses(array());
        
$container->getCompilerPassConfig()->setRemovingPasses(array());
        
$container->compile();
    }
}
Онлайн: 1
Реклама