setConnectionGroup() public static method

Set a connection group
public static setConnectionGroup ( string $name, Shanty_Mongo_Connection_Group $connectionGroup )
$name string
$connectionGroup Shanty_Mongo_Connection_Group
Esempio n. 1
0
 public function testConnectionGroups()
 {
     $this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, Shanty_Mongo::getConnectionGroups());
     $this->assertEquals(0, count(Shanty_Mongo::getConnectionGroups()));
     $connectionGroup = new Shanty_Mongo_Connection_Group();
     Shanty_Mongo::setConnectionGroup('users', $connectionGroup);
     $this->assertEquals(1, count(Shanty_Mongo::getConnectionGroups()));
     $this->assertEquals(Shanty_Mongo::getConnectionGroup('users'), $connectionGroup);
     $this->assertFalse(Shanty_Mongo::hasConnectionGroup('accounts'));
     $this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_OBJECT, Shanty_Mongo::getConnectionGroup('accounts'));
     $this->assertEquals(2, count(Shanty_Mongo::getConnectionGroups()));
     $this->assertTrue(Shanty_Mongo::hasConnectionGroup('accounts'));
 }