Skip to content

Commit

Permalink
Changed default logging param to kernel.debug and fixed container uni…
Browse files Browse the repository at this point in the history
…t test
  • Loading branch information
stof committed Mar 9, 2011
1 parent f37a2a9 commit e522424
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
Expand Up @@ -24,13 +24,18 @@
*/
class Configuration
{
private $kernelDebug;

/**
* Generates the configuration tree.
*
* @param Boolean $kernelDebug
* @return \Symfony\Component\Config\Definition\NodeInterface
*/
public function getConfigTree()
public function getConfigTree($kernelDebug)
{
$this->kernelDebug = (bool) $kernelDebug;

$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('doctrine', 'array');

Expand Down Expand Up @@ -109,7 +114,7 @@ private function getDbalConnectionsNode()
->scalarNode('wrapper_class')->end()
->scalarNode('platform_service')->end()
->scalarNode('charset')->defaultValue('UTF-8')->end()
->booleanNode('logging')->defaultFalse()->end()
->booleanNode('logging')->defaultValue($this->kernelDebug)->end()
->end()
;

Expand Down
Expand Up @@ -34,7 +34,7 @@ public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$processor = new Processor();
$config = $processor->process($configuration->getConfigTree(), $configs);
$config = $processor->process($configuration->getConfigTree($container->getParameter('kernel.debug')), $configs);

if (!empty($config['dbal'])) {
$this->dbalLoad($config['dbal'], $container);
Expand Down
Expand Up @@ -658,6 +658,7 @@ protected function getContainer($bundles = 'YamlBundle', $vendor = null)
}

return new ContainerBuilder(new ParameterBag(array(
'kernel.debug' => false,
'kernel.bundles' => $map,
'kernel.cache_dir' => sys_get_temp_dir(),
'kernel.root_dir' => __DIR__ . "/../../../../../" // src dir
Expand Down
32 changes: 17 additions & 15 deletions src/Symfony/Bundle/DoctrineBundle/Tests/TestCase.php
Expand Up @@ -50,31 +50,33 @@ protected function createTestEntityManager($paths = array())
public function createYamlBundleTestContainer()
{
$container = new ContainerBuilder(new ParameterBag(array(
'kernel.debug' => false,
'kernel.bundles' => array('YamlBundle' => 'Fixtures\Bundles\YamlBundle\YamlBundle'),
'kernel.cache_dir' => sys_get_temp_dir(),
'kernel.root_dir' => __DIR__ . "/../../../../" // src dir
)));
$loader = new DoctrineExtension();
$container->registerExtension($loader);
$loader->load(array(array('dbal' => array(
'connections' => array(
'default' => array(
'driver' => 'pdo_mysql',
'charset' => 'UTF-8',
'platform-service' => 'my.platform',
)
),
'types' => array(
'test' => 'Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestType',
),
))), $container);
$loader->load(array(
array('orm' => array(
$loader->load(array(array(
'dbal' => array(
'connections' => array(
'default' => array(
'driver' => 'pdo_mysql',
'charset' => 'UTF-8',
'platform-service' => 'my.platform',
)
),
'default_connection' => 'default',
'types' => array(
'test' => 'Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestType',
),
), 'orm' => array(
'mappings' => array('YamlBundle' => array(
'type' => 'yml',
'dir' => __DIR__ . "/DependencyInjection/Fixtures/Bundles/YamlBundle/Resources/config/doctrine/metadata/orm",
'prefix' => 'Fixtures\Bundles\YamlBundle',
))))), $container);
)))
)), $container);

$container->setDefinition('my.platform', new \Symfony\Component\DependencyInjection\Definition('Doctrine\DBAL\Platforms\MySqlPlatform'));

Expand Down

0 comments on commit e522424

Please sign in to comment.