LazyRecord\Testing\BaseTestCase::prepareConnection PHP Method

prepareConnection() protected method

protected prepareConnection ( )
    protected function prepareConnection()
    {
        if (!$this->conn) {
            try {
                $this->conn = $this->connManager->getConnection($this->getDataSource());
            } catch (PDOException $e) {
                if ($this->allowConnectionFailure) {
                    $this->markTestSkipped(sprintf("Can not connect to database by data source '%s' message:'%s' config:'%s'", $this->getDataSource(), $e->getMessage(), var_export($this->config->getDataSource($this->getDataSource()), true)));
                    return;
                }
                echo sprintf("Can not connect to database by data source '%s' message:'%s' config:'%s'", $this->getDataSource(), $e->getMessage(), var_export($this->config->getDataSource($this->getDataSource()), true));
                throw $e;
            }
            $this->queryDriver = $this->connManager->getQueryDriver($this->getDataSource());
        }
    }