Imbo\Database\Doctrine::getStatus PHP Method

getStatus() public method

public getStatus ( )
    public function getStatus()
    {
        try {
            $connection = $this->getConnection();
            return $connection->isConnected() || $connection->connect();
        } catch (PDOException $e) {
            return false;
        }
    }

Usage Example

Beispiel #1
0
 /**
  * @covers Imbo\Database\Doctrine::getStatus
  */
 public function testGetStatusWhenDatabaseIsNotConnectedAndConnectThrowsAnException()
 {
     $this->connection->expects($this->once())->method('isConnected')->will($this->returnValue(false));
     $this->connection->expects($this->once())->method('connect')->will($this->throwException(new PDOException()));
     $this->assertFalse($this->driver->getStatus());
 }