Returns the MongoDB database with the given name.
/** * @depends testGetDatabase */ public function testGetDefaultDatabase() { $connection = new Connection(); $connection->dsn = $this->mongoDbConfig['dsn']; $connection->defaultDatabaseName = $this->mongoDbConfig['defaultDatabaseName']; $database = $connection->getDatabase(); $this->assertTrue($database instanceof Database, 'Unable to get default database!'); $connection = new Connection(); $connection->dsn = $this->mongoDbConfig['dsn']; $connection->options = ['db' => $this->mongoDbConfig['defaultDatabaseName']]; $database = $connection->getDatabase(); $this->assertTrue($database instanceof Database, 'Unable to determine default database from options!'); $connection = new Connection(); $connection->dsn = $this->mongoDbConfig['dsn'] . '/' . $this->mongoDbConfig['defaultDatabaseName']; $database = $connection->getDatabase(); $this->assertTrue($database instanceof Database, 'Unable to determine default database from dsn!'); }