getConnectionGroups() public static method

Get a list of all connection groups
public static getConnectionGroups ( ) : array
return array
Ejemplo n.º 1
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()));
 }