getSelectedDb() public method

Return the selected database
public getSelectedDb ( ) : integer
return integer
示例#1
0
 public function testGettersAndSetters()
 {
     $this->assertEquals($this->credis->getHost(), $this->config[0]->host);
     $this->assertEquals($this->credis->getPort(), $this->config[0]->port);
     $this->assertEquals($this->credis->getSelectedDb(), 0);
     $this->assertTrue($this->credis->select(2));
     $this->assertEquals($this->credis->getSelectedDb(), 2);
     $this->assertTrue($this->credis->isConnected());
     $this->credis->close();
     $this->assertFalse($this->credis->isConnected());
     $this->credis = new Credis_Client($this->config[0]->host, $this->config[0]->port, null, 'persistenceId');
     $this->assertEquals('persistenceId', $this->credis->getPersistence());
     $this->credis = new Credis_Client('localhost', 12345);
     $this->credis->setMaxConnectRetries(1);
     $this->setExpectedException('CredisException', 'Connection to Redis failed after 2 failures.');
     $this->credis->connect();
 }