public function testDbalLoad() { $configuration = new BuilderConfiguration(); $loader = new DoctrineExtension(array(), array()); $configuration = $loader->dbalLoad(array(), $configuration); $this->assertEquals('Symfony\\Bundle\\DoctrineBundle\\DataCollector\\DoctrineDataCollector', $configuration->getParameter('doctrine.data_collector.class'), '->dbalLoad() loads the dbal.xml file if not already loaded'); // doctrine.dbal.default_connection $this->assertEquals('default', $configuration->getParameter('doctrine.dbal.default_connection'), '->dbalLoad() overrides existing configuration options'); $configuration = $loader->dbalLoad(array('default_connection' => 'foo'), $configuration); $this->assertEquals('foo', $configuration->getParameter('doctrine.dbal.default_connection'), '->dbalLoad() overrides existing configuration options'); $configuration = $loader->dbalLoad(array(), $configuration); $this->assertEquals('foo', $configuration->getParameter('doctrine.dbal.default_connection'), '->dbalLoad() overrides existing configuration options'); $configuration = new BuilderConfiguration(); $loader = new DoctrineExtension(array(), array()); $configuration = $loader->dbalLoad(array('password' => 'foo'), $configuration); $arguments = $configuration->getDefinition('doctrine.dbal.default_connection')->getArguments(); $config = $arguments[0]; $this->assertEquals('foo', $config['password']); $this->assertEquals('root', $config['user']); $configuration = $loader->dbalLoad(array('user' => 'foo'), $configuration); $this->assertEquals('foo', $config['password']); $this->assertEquals('root', $config['user']); }
public function testAnnotationsBundleMappingDetectionWithVendorNamespace() { $container = $this->getContainer('AnnotationsBundle', 'Vendor'); $loader = new DoctrineExtension(); $loader->dbalLoad(array(), $container); $loader->ormLoad(array('mappings' => array('AnnotationsBundle' => array())), $container); $calls = $container->getDefinition('doctrine.orm.default_metadata_driver')->getMethodCalls(); $this->assertEquals('doctrine.orm.default_annotation_metadata_driver', (string) $calls[0][1][0]); $this->assertEquals('DoctrineBundle\\Tests\\DependencyInjection\\Fixtures\\Bundles\\Vendor\\AnnotationsBundle\\Entity', $calls[0][1][1]); }
public function testAnnotationsBundleMappingDetection() { $container = $this->getContainer('AnnotationsBundle'); $loader = new DoctrineExtension(); $loader->dbalLoad(array(), $container); $loader->ormLoad(array(), $container); $this->assertEquals(array(), $container->getParameter('doctrine.orm.metadata_driver.mapping_dirs')); $this->assertEquals('%doctrine.orm.metadata_driver.mapping_dirs%', $container->getParameter('doctrine.orm.xml_mapping_dirs')); $this->assertEquals('%doctrine.orm.metadata_driver.mapping_dirs%', $container->getParameter('doctrine.orm.yml_mapping_dirs')); $this->assertEquals(array(__DIR__ . '/Fixtures/Bundles/AnnotationsBundle/Entity'), $container->getParameter('doctrine.orm.metadata_driver.entity_dirs')); $calls = $container->getDefinition('doctrine.orm.metadata_driver')->getMethodCalls(); $this->assertEquals('doctrine.orm.metadata_driver.annotation', (string) $calls[0][1][0]); $this->assertEquals('DoctrineBundle\\Tests\\DependencyInjection\\Fixtures\\Bundles\\AnnotationsBundle\\Entity', $calls[0][1][1]); }
public function testAnnotationsBundleMappingDetectionWithVendorNamespace() { $container = $this->getContainer('AnnotationsBundle', 'Vendor'); $loader = new DoctrineExtension(); $loader->load(array(array('orm' => array('default_entity_manager' => 'default', 'entity_managers' => array('default' => array('mappings' => array('AnnotationsBundle' => array())))))), $container); $calls = $container->getDefinition('doctrine.orm.default_metadata_driver')->getMethodCalls(); $this->assertEquals('doctrine.orm.default_annotation_metadata_driver', (string) $calls[0][1][0]); $this->assertEquals('Fixtures\Bundles\Vendor\AnnotationsBundle\Entity', $calls[0][1][1]); }