diff --git a/src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/DependencyInjection/AbstractMongoDBExtensionTest.php b/src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/DependencyInjection/AbstractMongoDBExtensionTest.php index e09c01c80b..063daa7bf4 100644 --- a/src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/DependencyInjection/AbstractMongoDBExtensionTest.php +++ b/src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/DependencyInjection/AbstractMongoDBExtensionTest.php @@ -70,8 +70,9 @@ abstract class AbstractMongoDBExtensionTest extends TestCase $arguments = $definition->getArguments(); $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[0]); $this->assertEquals('doctrine.odm.mongodb.default_connection', (string) $arguments[0]); - $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[1]); - $this->assertEquals('doctrine.odm.mongodb.default_configuration', (string) $arguments[1]); + $this->assertEquals('default', $arguments[1]); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[2]); + $this->assertEquals('doctrine.odm.mongodb.default_configuration', (string) $arguments[2]); } public function testSingleDocumentManagerConfiguration() @@ -81,7 +82,8 @@ abstract class AbstractMongoDBExtensionTest extends TestCase $config = array( 'server' => 'mongodb://localhost:27017', - 'options' => array('connect' => true) + 'options' => array('connect' => true), + 'default_database' => 'test' ); $loader->mongodbLoad(array($config), $container); @@ -98,8 +100,9 @@ abstract class AbstractMongoDBExtensionTest extends TestCase $arguments = $definition->getArguments(); $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[0]); $this->assertEquals('doctrine.odm.mongodb.default_connection', (string) $arguments[0]); - $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[1]); - $this->assertEquals('doctrine.odm.mongodb.default_configuration', (string) $arguments[1]); + $this->assertEquals('test', $arguments[1]); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[2]); + $this->assertEquals('doctrine.odm.mongodb.default_configuration', (string) $arguments[2]); } public function testLoadSimpleSingleConnection() @@ -133,8 +136,9 @@ abstract class AbstractMongoDBExtensionTest extends TestCase $arguments = $definition->getArguments(); $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[0]); $this->assertEquals('doctrine.odm.mongodb.default_connection', (string) $arguments[0]); - $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[1]); - $this->assertEquals('doctrine.odm.mongodb.default_configuration', (string) $arguments[1]); + $this->assertEquals('mydb', $arguments[1]); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[2]); + $this->assertEquals('doctrine.odm.mongodb.default_configuration', (string) $arguments[2]); } public function testLoadSingleConnection() @@ -162,8 +166,9 @@ abstract class AbstractMongoDBExtensionTest extends TestCase $arguments = $definition->getArguments(); $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[0]); $this->assertEquals('doctrine.odm.mongodb.default_connection', (string) $arguments[0]); - $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[1]); - $this->assertEquals('doctrine.odm.mongodb.default_configuration', (string) $arguments[1]); + $this->assertEquals('default', $arguments[1]); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[2]); + $this->assertEquals('doctrine.odm.mongodb.default_configuration', (string) $arguments[2]); } public function testLoadMultipleConnections() @@ -193,8 +198,9 @@ abstract class AbstractMongoDBExtensionTest extends TestCase $arguments = $definition->getArguments(); $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[0]); $this->assertEquals('doctrine.odm.mongodb.conn1_connection', (string) $arguments[0]); - $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[1]); - $this->assertEquals('doctrine.odm.mongodb.dm1_configuration', (string) $arguments[1]); + $this->assertEquals('default', $arguments[1]); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[2]); + $this->assertEquals('doctrine.odm.mongodb.dm1_configuration', (string) $arguments[2]); $definition = $container->getDefinition('doctrine.odm.mongodb.conn2_connection'); $this->assertEquals('%doctrine.odm.mongodb.connection_class%', $definition->getClass()); @@ -209,8 +215,9 @@ abstract class AbstractMongoDBExtensionTest extends TestCase $arguments = $definition->getArguments(); $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[0]); $this->assertEquals('doctrine.odm.mongodb.conn2_connection', (string) $arguments[0]); - $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[1]); - $this->assertEquals('doctrine.odm.mongodb.dm2_configuration', (string) $arguments[1]); + $this->assertEquals('prod2', $arguments[1]); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[2]); + $this->assertEquals('doctrine.odm.mongodb.dm2_configuration', (string) $arguments[2]); } public function testBundleDocumentAliases() diff --git a/src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/DependencyInjection/Fixtures/config/xml/mongodb_service_multiple_connections.xml b/src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/DependencyInjection/Fixtures/config/xml/mongodb_service_multiple_connections.xml index eed523fc92..0daf648309 100644 --- a/src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/DependencyInjection/Fixtures/config/xml/mongodb_service_multiple_connections.xml +++ b/src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/DependencyInjection/Fixtures/config/xml/mongodb_service_multiple_connections.xml @@ -27,7 +27,9 @@ - + + prod2 + \ No newline at end of file diff --git a/src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/DependencyInjection/Fixtures/config/yml/mongodb_service_multiple_connections.yml b/src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/DependencyInjection/Fixtures/config/yml/mongodb_service_multiple_connections.yml index 391d10cfc7..a6172ab257 100644 --- a/src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/DependencyInjection/Fixtures/config/yml/mongodb_service_multiple_connections.yml +++ b/src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/DependencyInjection/Fixtures/config/yml/mongodb_service_multiple_connections.yml @@ -16,4 +16,5 @@ doctrine_odm.mongodb: connection: conn1 metadata_cache_driver: xcache dm2: - connection: conn2 \ No newline at end of file + connection: conn2 + database: prod2 \ No newline at end of file diff --git a/src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/TestCase.php b/src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/TestCase.php index 762c96f12a..0c960d6977 100644 --- a/src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/TestCase.php +++ b/src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/TestCase.php @@ -37,6 +37,6 @@ class TestCase extends \PHPUnit_Framework_TestCase $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver($paths)); $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); - return DocumentManager::create(new Connection(), $config); + return DocumentManager::create(new Connection(), 'test', $config); } }