Example #1
0
 /**
  * @depends testMakeConnection
  */
 public function testGetDB($conn)
 {
     $db = Client::db('test');
     $this->assertTrue($db instanceof MongoDB);
     $database = $conn->getDefaultDatabase();
     $this->assertEquals('test', $database);
     $conn->setDefaultDatabase('test2');
     $database = $conn->getDefaultDatabase();
     $this->assertEquals('test2', $database);
     $this->assertTrue(Model::db() instanceof MongoDB);
     $conn->setDefaultDatabase('test');
 }
Example #2
0
 /**
  * Share connection to call functions stactically with connection as default
  */
 public static function shareConnection(MongoClient $connection)
 {
     static::$shared_connection = $connection;
     Model::setDb($connection->getDefaultDatabase());
 }