_name, $this->_user, $this->_pass); \b8\Database::setReadServers(array($this->_host)); $connection = \b8\Database::getConnection('read'); $this->assertInstanceOf('\b8\Database', $connection); } public function testGetWriteConnection() { \b8\Database::setDetails($this->_name, $this->_user, $this->_pass); \b8\Database::setWriteServers(array($this->_host)); $connection = \b8\Database::getConnection('write'); $this->assertInstanceOf('\b8\Database', $connection); } public function testGetDetails() { \b8\Database::setDetails($this->_name, $this->_user, $this->_pass); \b8\Database::setReadServers(array('localhost')); $details = \b8\Database::getConnection('read')->getDetails(); $this->assertTrue(is_array($details)); $this->assertTrue(($details['db'] == $this->_name)); $this->assertTrue(($details['user'] == $this->_user)); $this->assertTrue(($details['pass'] == $this->_pass)); } /** * @expectedException \Exception */ public function testConnectionFailure() { \b8\Database::setDetails('non_existant', 'invalid_user', 'incorrect_password'); \b8\Database::setReadServers(array('localhost')); \b8\Database::getConnection('read'); } }