예제 #1
0
 public function testOptionsAddServer()
 {
     $options = new SSDBOptions();
     $options->addServer('127.0.0.1', 8888);
     $options->addServer('localhost');
     $options->addServer('domain.com', 11215);
     $servers = array(array('host' => '127.0.0.1', 'port' => 8888, 'weight' => 0, 'type' => 'master'), array('host' => '127.0.0.1', 'port' => 8888, 'weight' => 0, 'type' => 'slave'), array('host' => 'localhost', 'port' => 8888, 'weight' => 0, 'type' => 'slave'), array('host' => 'domain.com', 'port' => 11215, 'weight' => 0, 'type' => 'slave'));
     $this->assertEquals($options->getServers(), $servers);
     $SSDB = new SSDB($options);
     $this->assertEquals($SSDB->getOptions()->getServers(), $servers);
 }
예제 #2
0
 public function testGetSlaves()
 {
     $options = new SSDBOptions();
     $options->addServer('localhost');
     $this->assertEquals(array(array('host' => '127.0.0.1', 'port' => 8888, 'weight' => 0, 'type' => SSDBOptions::TYPE_MASTER), array('host' => '127.0.0.1', 'port' => 8888, 'weight' => 0, 'type' => SSDBOptions::TYPE_SLAVE), array('host' => 'localhost', 'port' => 8888, 'weight' => 0, 'type' => SSDBOptions::TYPE_SLAVE)), $options->getSlaveServers());
 }