removeConnectionGroups() public static method

Remove all connection groups
public static removeConnectionGroups ( )
Ejemplo n.º 1
0
 public function testGetDbName()
 {
     $this->assertEquals(TESTS_SHANTY_MONGO_DB, My_ShantyMongo_User::getDbName());
     Shanty_Mongo::removeConnectionGroups();
     $connection = new Shanty_Mongo_Connection('localhost/shanty-mongo');
     Shanty_Mongo::addMaster($connection);
     $this->assertEquals(TESTS_SHANTY_MONGO_DB, My_ShantyMongo_User::getDbName());
     $this->assertEquals('shanty-mongo', My_ShantyMongo_Name::getDbName());
 }
Ejemplo n.º 2
0
 public function testAddConnectionsMultipleGroups()
 {
     $connections = array('users' => array('host' => 'localhost'), 'accounts' => array('masters' => array(0 => array('host' => '127.0.0.1'), 1 => array('host' => 'localhost')), 'slaves' => array(0 => array('host' => '127.0.0.1'), 1 => array('host' => 'localhost'))));
     Shanty_Mongo::addConnections($connections);
     $this->assertEquals(2, count(Shanty_Mongo::getConnectionGroups()));
     $this->assertEquals(1, count(Shanty_Mongo::getConnectionGroup('users')->getMasters()));
     $this->assertEquals(0, count(Shanty_Mongo::getConnectionGroup('users')->getSlaves()));
     $this->assertEquals(2, count(Shanty_Mongo::getConnectionGroup('accounts')->getMasters()));
     $this->assertEquals(2, count(Shanty_Mongo::getConnectionGroup('accounts')->getSlaves()));
     Shanty_Mongo::removeConnectionGroups();
     $this->assertEquals(0, count(Shanty_Mongo::getConnectionGroups()));
     Shanty_Mongo::addConnections(new Zend_Config($connections));
     $this->assertEquals(2, count(Shanty_Mongo::getConnectionGroups()));
     $this->assertEquals(1, count(Shanty_Mongo::getConnectionGroup('users')->getMasters()));
     $this->assertEquals(0, count(Shanty_Mongo::getConnectionGroup('users')->getSlaves()));
     $this->assertEquals(2, count(Shanty_Mongo::getConnectionGroup('accounts')->getMasters()));
     $this->assertEquals(2, count(Shanty_Mongo::getConnectionGroup('accounts')->getSlaves()));
 }